Class: MotionSpec::Matcher::SingleMethod
- Inherits:
-
Object
- Object
- MotionSpec::Matcher::SingleMethod
show all
- Defined in:
- lib/motion-spec/matcher/single_method.rb
Instance Method Summary
collapse
Constructor Details
#initialize(method_name, *values) ⇒ SingleMethod
Returns a new instance of SingleMethod.
5
6
7
8
|
# File 'lib/motion-spec/matcher/single_method.rb', line 5
def initialize(method_name, *values)
@values = values
@method_name = method_name
end
|
Instance Method Details
#fail!(subject, negated) ⇒ Object
14
15
16
|
# File 'lib/motion-spec/matcher/single_method.rb', line 14
def fail!(subject, negated)
raise FailedExpectation.new(fail_message(subject, negated))
end
|
#fail_message(subject, negated = false) ⇒ Object
18
19
20
21
22
|
# File 'lib/motion-spec/matcher/single_method.rb', line 18
def fail_message(subject, negated = false)
FailMessageRenderer.message_for_be(
negated, subject, @method_name, @values
)
end
|
#matches?(subject) ⇒ Boolean
10
11
12
|
# File 'lib/motion-spec/matcher/single_method.rb', line 10
def matches?(subject)
subject.send(@method_name, *@values)
end
|