Class: Smartest::MatchMatcher
- Defined in:
- lib/smartest/matchers.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(regexp) ⇒ MatchMatcher
constructor
A new instance of MatchMatcher.
- #matches?(actual) ⇒ Boolean
- #negated_failure_message ⇒ Object
Methods inherited from Matcher
Constructor Details
#initialize(regexp) ⇒ MatchMatcher
Returns a new instance of MatchMatcher.
381 382 383 |
# File 'lib/smartest/matchers.rb', line 381 def initialize(regexp) @regexp = regexp end |
Instance Method Details
#description ⇒ Object
400 401 402 |
# File 'lib/smartest/matchers.rb', line 400 def description "match #{@regexp.inspect}" end |
#failure_message ⇒ Object
392 393 394 |
# File 'lib/smartest/matchers.rb', line 392 def "expected #{@actual.inspect} to match #{@regexp.inspect}" end |
#matches?(actual) ⇒ Boolean
385 386 387 388 389 390 |
# File 'lib/smartest/matchers.rb', line 385 def matches?(actual) @actual = actual @regexp.match?(actual) rescue NoMethodError, TypeError false end |
#negated_failure_message ⇒ Object
396 397 398 |
# File 'lib/smartest/matchers.rb', line 396 def "expected #{@actual.inspect} not to match #{@regexp.inspect}" end |