diff --git a/lib/rspec/matchers/include.rb b/lib/rspec/matchers/include.rb index fccc7e9bd..0bda36b50 100644 --- a/lib/rspec/matchers/include.rb +++ b/lib/rspec/matchers/include.rb @@ -22,14 +22,14 @@ def description private - def perform_match(predicate, hash_predicate, actual, expected) - expected.send(predicate) do |expected| - if comparing_hash_values?(actual, expected) - expected.send(hash_predicate) {|k,v| actual[k] == v} - elsif comparing_hash_keys?(actual, expected) - actual.has_key?(expected) + def perform_match(predicate, hash_predicate, actuals, expecteds) + expecteds.send(predicate) do |expected| + if comparing_hash_values?(actuals, expected) + expected.send(hash_predicate) {|k,v| actuals[k] == v} + elsif comparing_hash_keys?(actuals, expected) + actuals.has_key?(expected) else - actual.include?(expected) + actuals.include?(expected) end end end diff --git a/lib/rspec/matchers/pretty.rb b/lib/rspec/matchers/pretty.rb index 427dadf99..7e7289a67 100644 --- a/lib/rspec/matchers/pretty.rb +++ b/lib/rspec/matchers/pretty.rb @@ -39,7 +39,7 @@ def name_to_sentence end def expected_to_sentence - to_sentence(@expected) + to_sentence(@expected) if defined?(@expected) end def name @@ -55,7 +55,6 @@ def underscore(camel_cased_word) word.downcase! word end - end end end diff --git a/spec/rspec/matchers/change_spec.rb b/spec/rspec/matchers/change_spec.rb index d70d63d8d..7f61ca47f 100644 --- a/spec/rspec/matchers/change_spec.rb +++ b/spec/rspec/matchers/change_spec.rb @@ -113,7 +113,7 @@ def <<(element) end def dup - self.class.new *elements + self.class.new(*elements) end def ==(other)