result should have been changed by 0, but was changed by 0 #17

wincent opened this Issue Sep 13, 2010 · 4 comments

3 participants


Just jumped from beta.20 to beta.22 and I'm seeing this new failure:

 Failure/Error: expect do
 result should have been changed by 0, but was changed by 0

This is a spec to ensure that, given a model with tag "foo", tagging it again with "foo" doesn't actually increase the tag count.

The relevant part of the spec reads like this:

    expect do
      model.tag 'foo' change { model.tags.size }.by(0)

There are other specs in the same file which all work, but they expect to change by(1) or some other non-zero value. Seems that something about by(0) is busted.

Workaround for now: rewrite by(0) specs like this:

    expect do
      model.tag 'foo'
    end.to_not change { model.tags.size }

Perhaps I should have written it this way in the first place, but the change by(0) version followed immediately after a run of other specs which all did change by(x), so I just followed the same pattern.



Nice one!

RSpec member

fix for change by(0) bug

  • Closed by 7c0d1aa3ce7744812edb73fb5ac7bb6b5ea11c90.
RSpec member

Fixed: fa4446d

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment