Class: CodeDrivenDevelopment::Rule::MethodCall

Inherits:
AbstractRule
  • Object
show all
Defined in:
lib/code_driven_development/rule/method_call.rb

Instance Method Summary collapse

Methods inherited from AbstractRule

#initialize

Constructor Details

This class inherits a constructor from CodeDrivenDevelopment::Rule::AbstractRule

Instance Method Details

#capable?Boolean

Returns:

  • (Boolean)


4
5
6
7
# File 'lib/code_driven_development/rule/method_call.rb', line 4

def capable?
  code.sexp_type == :call &&
    stubber.method_name != :validate
end

#testObject



9
10
11
12
13
# File 'lib/code_driven_development/rule/method_call.rb', line 9

def test
  test_context.doubles.concat(stubber.doubles.map { |sym| TestComponent::Double.new(sym) })
  test_context.befores.concat(stubber.befores)
  test_context << TestComponent::Test.new("calls #{stubber.human_name}", ["subject"] + stubber.body)
end