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