Class: 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
Methods inherited from Matcher
Constructor Details
#initialize(expected) ⇒ IncludeMatcher
Returns a new instance of IncludeMatcher.
236 237 238 |
# File 'lib/smartest/matchers.rb', line 236 def initialize(expected) @expected = expected end |
Instance Method Details
#description ⇒ Object
255 256 257 |
# File 'lib/smartest/matchers.rb', line 255 def description "include #{@expected.inspect}" end |
#failure_message ⇒ Object
247 248 249 |
# File 'lib/smartest/matchers.rb', line 247 def "expected #{@actual.inspect} to include #{@expected.inspect}" end |
#matches?(actual) ⇒ Boolean
240 241 242 243 244 245 |
# File 'lib/smartest/matchers.rb', line 240 def matches?(actual) @actual = actual actual.include?(@expected) rescue NoMethodError false end |
#negated_failure_message ⇒ Object
251 252 253 |
# File 'lib/smartest/matchers.rb', line 251 def "expected #{@actual.inspect} not to include #{@expected.inspect}" end |