Class: Smartest::IncludeMatcher
- Inherits:
-
Object
- Object
- Smartest::IncludeMatcher
- Defined in:
- lib/smartest/matchers.rb
Instance Method Summary collapse
- #failure_message ⇒ Object
-
#initialize(expected) ⇒ IncludeMatcher
constructor
A new instance of IncludeMatcher.
- #matches?(actual) ⇒ Boolean
- #negated_failure_message ⇒ Object
Constructor Details
#initialize(expected) ⇒ IncludeMatcher
Returns a new instance of IncludeMatcher.
57 58 59 |
# File 'lib/smartest/matchers.rb', line 57 def initialize(expected) @expected = expected end |
Instance Method Details
#failure_message ⇒ Object
68 69 70 |
# File 'lib/smartest/matchers.rb', line 68 def "expected #{@actual.inspect} to include #{@expected.inspect}" end |
#matches?(actual) ⇒ Boolean
61 62 63 64 65 66 |
# File 'lib/smartest/matchers.rb', line 61 def matches?(actual) @actual = actual actual.include?(@expected) rescue NoMethodError false end |
#negated_failure_message ⇒ Object
72 73 74 |
# File 'lib/smartest/matchers.rb', line 72 def "expected #{@actual.inspect} not to include #{@expected.inspect}" end |