RSpec::Matchers::Change with from(true).to(false) change #16

Closed
dolzenko opened this Issue Sep 8, 2010 · 3 comments

Comments

Projects
None yet
2 participants
@dolzenko

dolzenko commented Sep 8, 2010

require 'spec_helper'

describe RSpec::Matchers::Change do
  it "sets wrong failure message" do
    @a = true
    lambda {
      nil
    }.should change { @a }.from(true).to(false)
  end

  it "passes successfully wrong change" do
    @a = true
    lambda {
      @a = 1
    }.should change { @a }.from(true).to(false)
  end
end

prints

RSpec::Matchers::Change
  sets wrong failure message (FAILED - 1)
  passes successfully wrong change

Failures:
  1) RSpec::Matchers::Change sets wrong failure message
     Failure/Error: lambda {
     result should have initially been true, but was true
     # /usr/local/rvm/gems/ree-1.8.7-2010.02@rails3/gems/rspec-expectations-2.0.0.beta.20/lib/rspec/expectations/fail_with.rb:29:in `fail_with'
     # /usr/local/rvm/gems/ree-1.8.7-2010.02@rails3/gems/rspec-expectations-2.0.0.beta.20/lib/rspec/expectations/handler.rb:21:in `handle_matcher'
     # /usr/local/rvm/gems/ree-1.8.7-2010.02@rails3/gems/rspec-expectations-2.0.0.beta.20/lib/rspec/expectations/extensions/kernel.rb:27:in `should'
     # ./spec/models/test_spec.rb:6
@dchelimsky

This comment has been minimized.

Show comment Hide comment
@dchelimsky

dchelimsky Sep 9, 2010

Owner

Thanks for providing such a great example. This was very easy to track down because of it.

Owner

dchelimsky commented Sep 9, 2010

Thanks for providing such a great example. This was very easy to track down because of it.

@dchelimsky

This comment has been minimized.

Show comment Hide comment
@dchelimsky

dchelimsky Sep 9, 2010

Owner

should[_not] change now handles boolean values correctly

Owner

dchelimsky commented Sep 9, 2010

should[_not] change now handles boolean values correctly

@dolzenko

This comment has been minimized.

Show comment Hide comment
@dolzenko

dolzenko Sep 9, 2010

Awesome! Thanks a lot as usual!

dolzenko commented Sep 9, 2010

Awesome! Thanks a lot as usual!

This issue was closed.

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