Class: Spec::Matchers::Equal
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message_for_should ⇒ Object
- #failure_message_for_should_not ⇒ Object
-
#initialize(expected) ⇒ Equal
constructor
A new instance of Equal.
- #matches?(actual) ⇒ Boolean
Constructor Details
#initialize(expected) ⇒ Equal
Returns a new instance of Equal.
5 6 7 |
# File 'lib/spec/matchers/equal.rb', line 5 def initialize(expected) @expected = expected end |
Instance Method Details
#description ⇒ Object
22 23 24 |
# File 'lib/spec/matchers/equal.rb', line 22 def description "equal #{@expected.inspect}" end |
#failure_message_for_should ⇒ Object
14 15 16 |
# File 'lib/spec/matchers/equal.rb', line 14 def return "expected #{@expected.inspect}, got #{@actual.inspect} (using .equal?)", @expected, @actual end |
#failure_message_for_should_not ⇒ Object
18 19 20 |
# File 'lib/spec/matchers/equal.rb', line 18 def return "expected #{@actual.inspect} not to equal #{@expected.inspect} (using .equal?)", @expected, @actual end |
#matches?(actual) ⇒ Boolean
9 10 11 12 |
# File 'lib/spec/matchers/equal.rb', line 9 def matches?(actual) @actual = actual @actual.equal?(@expected) end |