Class: TestBelt::Matchers::HaveInstanceMethods::Matcher
- Inherits:
-
Base
- Object
- Base
- TestBelt::Matchers::HaveInstanceMethods::Matcher
show all
- Defined in:
- lib/test_belt/matchers/have_instance_methods.rb
Instance Attribute Summary
Attributes inherited from Base
#args
Instance Method Summary
collapse
Constructor Details
#initialize(method) ⇒ Matcher
Returns a new instance of Matcher.
18
19
20
21
22
23
|
# File 'lib/test_belt/matchers/have_instance_methods.rb', line 18
def initialize(method)
unless method.kind_of?(::String) || method.kind_of?(::Symbol)
raise ArgumentError, "please specify the method name using a string or symbol"
end
@method = method
end
|
Instance Method Details
#desc ⇒ Object
25
26
27
|
# File 'lib/test_belt/matchers/have_instance_methods.rb', line 25
def desc
"respond to #{method_type} ##{@method}"
end
|
#method_type ⇒ Object
35
36
37
|
# File 'lib/test_belt/matchers/have_instance_methods.rb', line 35
def method_type
"instance method"
end
|
#test ⇒ Object
29
30
31
32
33
|
# File 'lib/test_belt/matchers/have_instance_methods.rb', line 29
def test
using(@method) do |method|
assert subject.respond_to?(method, true), "#{subject.class.name} does not have instance method ##{method}"
end
end
|