Skip to content

Instantly share code, notes, and snippets.

View alto's full-sized avatar

Thorsten Böttger alto

View GitHub Profile
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2009 Aslak Hellesøy
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
In response to all the responses to:
http://twitter.com/rtomayko/status/1155906157
You should never do this in a source file included with your library,
app, or tests:
require 'rubygems'
The system I use to manage my $LOAD_PATH is not your library/app/tests
# 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....