Skip to content

Instantly share code, notes, and snippets.

@fj
Created June 18, 2010 19:34
Show Gist options
  • Save fj/444102 to your computer and use it in GitHub Desktop.
Save fj/444102 to your computer and use it in GitHub Desktop.
Found a bug in RSpec.
#RSpec 1.3.0, #Ruby 1.9.1
describe "Simple class" do
before :each do
@c = Class.new do
attr_accessor :apple
end.new
@c.apple = []
end
it "should change values" do
# Passes, but it's a false positive:
# `apple` is `[]`, not `nil`
->{ @c.apple = 100 }.should change(@c, :apple).from(nil).to(100)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment