Skip to content

Instantly share code, notes, and snippets.

@lancecarlson
Created August 23, 2010 21:05
Show Gist options
  • 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 => '[email protected]')
@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 => "[email protected]")
@friend2 = User.create(:email => "[email protected]")
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