Skip to content

Instantly share code, notes, and snippets.

@urbanautomaton
Created January 5, 2013 13:26
Show Gist options
  • Save urbanautomaton/4461579 to your computer and use it in GitHub Desktop.
Save urbanautomaton/4461579 to your computer and use it in GitHub Desktop.
require 'rspec'
class Thing; end
describe "change matcher" do
it "behaves counterintuitively with classes" do
thing = nil
expect {
thing = Thing
}.to change {
thing
}.from(nil).to(Thing)
end
end
$ rspec change_matcher_spec.rb
F
Failures:
1) change matcher behaves counterintuitively with classes
Failure/Error: expect {
result should have been changed to Thing, but is now Thing
# ./rspec_change_behaviour_spec.rb:8:in `block (2 levels) in <top (required)>'
Finished in 0.00233 seconds
1 example, 1 failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment