Class: CodeDrivenDevelopment::Rule::MethodCall
Instance Method Summary
collapse
#initialize
Instance Method Details
#capable? ⇒ Boolean
4
5
6
7
|
# File 'lib/code_driven_development/rule/method_call.rb', line 4
def capable?
code.sexp_type == :call &&
method_name != :validate
end
|
#test ⇒ Object
9
10
11
12
13
|
# File 'lib/code_driven_development/rule/method_call.rb', line 9
def test
test_context.befores << "allow(#{receiver}).to receive :#{method_name}"
body = ["expect(#{receiver}).to have_received :#{method_name}"]
test_context << TestComponent::Test.new("calls #{receiver}.#{method_name}", body)
end
|