Class: RSpec::Matchers::BuiltIn::Equal
- Inherits:
-
BaseMatcher
- Object
- BaseMatcher
- RSpec::Matchers::BuiltIn::Equal
- Defined in:
- lib/rspec/matchers/built_in/equal.rb
Instance Attribute Summary
Attributes inherited from BaseMatcher
#actual, #expected, #rescued_exception
Instance Method Summary collapse
- #diffable? ⇒ Boolean
- #failure_message_for_should ⇒ Object
- #failure_message_for_should_not ⇒ Object
- #match(expected, actual) ⇒ Object
Methods inherited from BaseMatcher
#==, #description, #initialize, #match_unless_raises, #matches?
Methods included from Pretty
#_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore
Constructor Details
This class inherits a constructor from RSpec::Matchers::BuiltIn::BaseMatcher
Instance Method Details
#diffable? ⇒ Boolean
34 |
# File 'lib/rspec/matchers/built_in/equal.rb', line 34 def diffable?; true; end |
#failure_message_for_should ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rspec/matchers/built_in/equal.rb', line 9 def return <<-MESSAGE expected #{inspect_object(expected)} got #{inspect_object(actual)} Compared using equal?, which compares object identity, but expected and actual are not the same object. Use `#{eq_expression}` if you don't care about object identity in this example. MESSAGE end |
#failure_message_for_should_not ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rspec/matchers/built_in/equal.rb', line 23 def return <<-MESSAGE expected not #{inspect_object(actual)} got #{inspect_object(expected)} Compared using equal?, which compares object identity. MESSAGE end |
#match(expected, actual) ⇒ Object
5 6 7 |
# File 'lib/rspec/matchers/built_in/equal.rb', line 5 def match(expected, actual) actual.equal? expected end |