]> git.openstreetmap.org Git - rails.git/blob - vendor/gems/rspec-1.1.2/lib/spec/matchers/eql.rb
Show whether a trace is public or private in the trace list, so that a user can easil...
[rails.git] / vendor / gems / rspec-1.1.2 / lib / spec / matchers / eql.rb
1 module Spec
2   module Matchers
3   
4     class Eql #:nodoc:
5       def initialize(expected)
6         @expected = expected
7       end
8   
9       def matches?(actual)
10         @actual = actual
11         @actual.eql?(@expected)
12       end
13
14       def failure_message
15         return "expected #{@expected.inspect}, got #{@actual.inspect} (using .eql?)", @expected, @actual
16       end
17       
18       def negative_failure_message
19         return "expected #{@actual.inspect} not to equal #{@expected.inspect} (using .eql?)", @expected, @actual
20       end
21
22       def description
23         "eql #{@expected.inspect}"
24       end
25     end
26     
27     # :call-seq:
28     #   should eql(expected)
29     #   should_not eql(expected)
30     #
31     # Passes if actual and expected are of equal value, but not necessarily the same object.
32     #
33     # See http://www.ruby-doc.org/core/classes/Object.html#M001057 for more information about equality in Ruby.
34     #
35     # == Examples
36     #
37     #   5.should eql(5)
38     #   5.should_not eql(3)
39     def eql(expected)
40       Matchers::Eql.new(expected)
41     end
42   end
43 end