Class: Spec::Matchers::MatchArray
- Defined in:
- lib/gems/rspec-1.1.12/lib/spec/matchers/match_array.rb
Overview
:nodoc:
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(expected) ⇒ MatchArray
constructor
A new instance of MatchArray.
- #matches?(actual) ⇒ Boolean
- #negative_failure_message ⇒ Object
Constructor Details
#initialize(expected) ⇒ MatchArray
Returns a new instance of MatchArray.
6 7 8 |
# File 'lib/gems/rspec-1.1.12/lib/spec/matchers/match_array.rb', line 6 def initialize(expected) @expected = expected end |
Instance Method Details
#description ⇒ Object
29 30 31 |
# File 'lib/gems/rspec-1.1.12/lib/spec/matchers/match_array.rb', line 29 def description "contain exactly #{_pretty_print(@expected)}" end |
#failure_message ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/gems/rspec-1.1.12/lib/spec/matchers/match_array.rb', line 17 def = "expected collection contained: #{@expected.sort.inspect}\n" += "actual collection contained: #{@actual.sort.inspect}\n" += "the missing elements were: #{@missing_items.sort.inspect}\n" unless @missing_items.empty? += "the extra elements were: #{@extra_items.sort.inspect}\n" unless @extra_items.empty? end |
#matches?(actual) ⇒ Boolean
10 11 12 13 14 15 |
# File 'lib/gems/rspec-1.1.12/lib/spec/matchers/match_array.rb', line 10 def matches?(actual) @actual = actual @extra_items = difference_between_arrays(@actual, @expected) @missing_items = difference_between_arrays(@expected, @actual) @extra_items.empty? && @missing_items.empty? end |
#negative_failure_message ⇒ Object
25 26 27 |
# File 'lib/gems/rspec-1.1.12/lib/spec/matchers/match_array.rb', line 25 def "Matcher does not support should_not" end |