rspec/rspec-expectations — Issue #115: NoMethodError: undefined method `first' in NegativeExpectationHandler
Author: rkistner
Created: 2012-02-06 12:26:45+00:00
State: open

In RSpec 2.8.0, I believe the line `rspec-expectations-2.8.0/lib/rspec/expectations/handler.rb:42` which contains:

::RSpec::Expectations.fail_with message, matcher.expected.first, matcher.actual

should be:

::RSpec::Expectations.fail_with message, matcher.expected, matcher.actual

Simple check to test this (the test should fail, but not raise this error):

"test".should_not RSpec::Matchers::Eq.new("test")

NoMethodError: undefined method `first' for 1:Fixnum
from /usr/local/lib/ruby/gems/1.9.1/gems/rspec-expectations-2.8.0/lib/rspec/expectations/handler.rb:42:in `handle_matcher'
from /usr/local/lib/ruby/gems/1.9.1/gems/rspec-expectations-2.8.0/lib/rspec/expectations/extensions/kernel.rb:24:in `should_not'
from (irb):28
from /usr/local/bin/irb:12:in `

'