Class: Smartest::IncludeMatcher
- Inherits:
-
Object
- Object
- Smartest::IncludeMatcher
- Defined in:
- lib/smartest/matchers.rb
Instance Method Summary collapse
- #description ⇒ Object
- #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.
81 82 83 |
# File 'lib/smartest/matchers.rb', line 81 def initialize(expected) @expected = expected end |
Instance Method Details
#description ⇒ Object
100 101 102 |
# File 'lib/smartest/matchers.rb', line 100 def description "include #{@expected.inspect}" end |
#failure_message ⇒ Object
92 93 94 |
# File 'lib/smartest/matchers.rb', line 92 def "expected #{@actual.inspect} to include #{@expected.inspect}" end |
#matches?(actual) ⇒ Boolean
85 86 87 88 89 90 |
# File 'lib/smartest/matchers.rb', line 85 def matches?(actual) @actual = actual actual.include?(@expected) rescue NoMethodError false end |
#negated_failure_message ⇒ Object
96 97 98 |
# File 'lib/smartest/matchers.rb', line 96 def "expected #{@actual.inspect} not to include #{@expected.inspect}" end |