~ubuntu-branches/ubuntu/oneiric/puppet/oneiric-security

« back to all changes in this revision

Viewing changes to vendor/gems/rspec/lib/spec/matchers/eql.rb

  • Committer: Bazaar Package Importer
  • Author(s): Micah Anderson
  • Date: 2008-07-26 15:43:45 UTC
  • mfrom: (1.1.8 upstream) (3.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080726154345-c03m49twzxewdwjn
Tags: 0.24.5-2
* Fix puppetlast to work with 0.24.5
* Adjust logcheck to match against new log messages in 0.24.5
* Update standards version to 3.8.0 (no changes)
* Update changelog to reduce length of line to make lintian happy

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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