Class: Smartest::ContainExactlyMatcher
- Defined in:
- lib/smartest/matchers.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(expected_items, matcher_name:) ⇒ ContainExactlyMatcher
constructor
A new instance of ContainExactlyMatcher.
- #matches?(actual) ⇒ Boolean
- #negated_failure_message ⇒ Object
Methods inherited from Matcher
Constructor Details
#initialize(expected_items, matcher_name:) ⇒ ContainExactlyMatcher
Returns a new instance of ContainExactlyMatcher.
406 407 408 409 410 |
# File 'lib/smartest/matchers.rb', line 406 def initialize(expected_items, matcher_name:) @expected_items = expected_items @matcher_name = matcher_name reset_result end |
Instance Method Details
#description ⇒ Object
431 432 433 |
# File 'lib/smartest/matchers.rb', line 431 def description "#{@matcher_name} #{format_expected_items(@expected_items)}" end |
#failure_message ⇒ Object
421 422 423 424 425 |
# File 'lib/smartest/matchers.rb', line 421 def details = failure_details = "expected #{@actual.inspect} to #{@matcher_name} #{format_expected_items(@expected_items)}" details.empty? ? : "#{}; #{details.join('; ')}" end |
#matches?(actual) ⇒ Boolean
412 413 414 415 416 417 418 419 |
# File 'lib/smartest/matchers.rb', line 412 def matches?(actual) @actual = actual reset_result return false unless actual_items? match_items @missing_items.empty? && @extra_items.empty? end |
#negated_failure_message ⇒ Object
427 428 429 |
# File 'lib/smartest/matchers.rb', line 427 def "expected #{@actual.inspect} not to #{@matcher_name} #{format_expected_items(@expected_items)}" end |