Skip to content

Instantly share code, notes, and snippets.

@alto
Created November 30, 2008 20:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alto/30515 to your computer and use it in GitHub Desktop.
Save alto/30515 to your computer and use it in GitHub Desktop.
# your_object.rb
class YourObject < ActiveRecord::Base
def your_method
self.your_association << TestObject.new
end
end
# your_object_spec.rb
it "should test your_method" do
lambda { your_object.your_method }.should change(your_object.your_association, :size) # => no change, test fails....
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment