Skip to content

Instantly share code, notes, and snippets.

@lancecarlson
Created August 23, 2010 21:05
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 lancecarlson/546332 to your computer and use it in GitHub Desktop.
Save lancecarlson/546332 to your computer and use it in GitHub Desktop.
before :each do
@user = User.new(:email => 'riak@ripple.com')
@profile = Profile.new(:name => 'Ripple')
@billing = Address.new(:street => '123 Somewhere Dr', :kind => 'billing')
@shipping = Address.new(:street => '321 Anywhere Pl', :kind => 'shipping')
@friend1 = User.create(:email => "friend@ripple.com")
@friend2 = User.create(:email => "friend2@ripple.com")
end
it "should save a many linked association" do
@user.friends << @friend1 << @friend2
@user.save
@user.should_not be_new_record
@found = User.find(@user.key)
@found.friends.map(&:key).should include(@friend1.key)
@found.friends.map(&:key).should include(@friend2.key)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment