Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

NoMethodError: undefined method `first' in NegativeExpectationHandler #115

Closed
rkistner opened this Issue · 5 comments

3 participants

@rkistner

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 `<main>'
@dchelimsky
Owner

There is some unfortunate legacy around matcher.expected.first so it can't just be changed without breaking a bunch of stuff out in the wild. What problem are you experiencing as a result?

@rkistner

Why is it only matcher.expected.first in NegativeExpectationHandler, but matcher.expected in PositiveExpectationHandler?

My test is a simple

a.should_not equal(b)

However, when the test fails, the above error is spewed instead of a descriptive message.

@dchelimsky dchelimsky closed this in 044b0a6
@dchelimsky dchelimsky referenced this issue from a commit
@dchelimsky dchelimsky Changlog for #115 503ed29
@e2
e2 commented

Could you bump Rspec to 1.8.1 to release this? Thanks.

@dchelimsky
Owner

Released 2.9.0.rc2 this morning. 2.9 to follow by the weekend barring any unforeseen issues.

@e2
e2 commented
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.