Class: RSpec::Mocks::ArgumentMatchers::EqualityProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/mocks/argument_matchers.rb

Instance Method Summary (collapse)

Constructor Details

- (EqualityProxy) initialize(given)

A new instance of EqualityProxy



107
108
109
# File 'lib/rspec/mocks/argument_matchers.rb', line 107

def initialize(given)
  @given = given
end

Instance Method Details

- (Object) ==(expected)



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/rspec/mocks/argument_matchers.rb', line 111

def ==(expected)
  if defined?(DateTime) && DateTime === expected
    RSpec.warn_deprecation <<-WARN.gsub(/^\s*\|/,'')
      |In RSpec 3.0.0 matchers use `#===` (the match operator) to perform
      |comparision between expected and actual arguments. Due to strange
      |behaviour with `DateTime#===` (which ignores the time of the object
      |when performing a comparison) this may result in undesired
      |behaviour. We recommend you switch to a `Date` or `Time` object
      |instead.
      |
      |Called from: #{RSpec::CallerFilter.first_non_rspec_line}
    WARN
  end
  @given == expected
end