Class: CodeDrivenDevelopment::Rule::ConstantMethodCall
- Inherits:
-
AbstractRule
- Object
- AbstractRule
- CodeDrivenDevelopment::Rule::ConstantMethodCall
show all
- Defined in:
- lib/code_driven_development/rule/constant_method_call.rb
Instance Method Summary
collapse
#initialize
Instance Method Details
#capable? ⇒ Boolean
4
5
6
7
8
|
# File 'lib/code_driven_development/rule/constant_method_call.rb', line 4
def capable?
code.sexp_type == :call &&
method_name != :validate &&
receiver_type == :const
end
|
#test ⇒ Object
10
11
12
13
14
|
# File 'lib/code_driven_development/rule/constant_method_call.rb', line 10
def test
test_context.befores << "allow(#{receiver_value}).to receive :#{method_name}"
body = ["expect(#{receiver_value}).to have_received :#{method_name}"]
test_context << TestComponent::Test.new("calls #{receiver_value}.#{method_name}", body)
end
|