lib/rspec/matchers/operator_matcher.rb in rspec-expectations-2.14.2 vs lib/rspec/matchers/operator_matcher.rb in rspec-expectations-2.14.3
- old
+ new
@@ -58,24 +58,28 @@
def description
"#{@operator} #{@expected.inspect}"
end
- private
+ private
if Method.method_defined?(:owner) # 1.8.6 lacks Method#owner :-(
def uses_generic_implementation_of?(op)
- @actual.method(op).owner == ::Kernel
+ Expectations.method_handle_for(@actual, op).owner == ::Kernel
+ rescue NameError
+ false
end
else
def uses_generic_implementation_of?(op)
# This is a bit of a hack, but:
#
# {}.method(:=~).to_s # => "#<Method: Hash(Kernel)#=~>"
#
# In the absence of Method#owner, this is the best we
# can do to see if the method comes from Kernel.
- @actual.method(op).to_s.include?('(Kernel)')
+ Expectations.method_handle_for(@actual, op).to_s.include?('(Kernel)')
+ rescue NameError
+ false
end
end
def eval_match(actual, operator, expected)
::RSpec::Matchers.last_matcher = self