Class: Mustard::BeMatcher
- Inherits:
-
Object
- Object
- Mustard::BeMatcher
- Defined in:
- lib/mustard/matchers/be_matcher.rb
Instance Method Summary collapse
- #failure_message ⇒ Object
-
#initialize(subject, method, *args) ⇒ BeMatcher
constructor
A new instance of BeMatcher.
- #match? ⇒ Boolean
- #message_action ⇒ Object
- #negative_failure_message ⇒ Object
Constructor Details
#initialize(subject, method, *args) ⇒ BeMatcher
Returns a new instance of BeMatcher.
3 4 5 6 7 |
# File 'lib/mustard/matchers/be_matcher.rb', line 3 def initialize(subject, method, *args) @subject = subject @method = method @args = args end |
Instance Method Details
#failure_message ⇒ Object
13 14 15 |
# File 'lib/mustard/matchers/be_matcher.rb', line 13 def "expected #{@subject.inspect} to be #{}" end |
#match? ⇒ Boolean
9 10 11 |
# File 'lib/mustard/matchers/be_matcher.rb', line 9 def match? @subject.send(@method, *@args) end |
#message_action ⇒ Object
21 22 23 24 25 |
# File 'lib/mustard/matchers/be_matcher.rb', line 21 def = @method.to_s.sub(/\?$/, "") += " " + @args.map(&:inspect).join(" and ") unless @args.empty? end |
#negative_failure_message ⇒ Object
17 18 19 |
# File 'lib/mustard/matchers/be_matcher.rb', line 17 def "expected #{@subject.inspect} to not be #{}" end |