Sha256: 6767e5215c5b6e2bb1fb38e1924d22c20a81f826bb4e0f320fa515f42566d2a3
Contents?: true
Size: 829 Bytes
Versions: 9
Compression:
Stored size: 829 Bytes
Contents
require 'spec_helper' describe "belongs to" do before do @simple = Simple.create @obj = BelongsToModel.create end after do Simple.destroy_all end it "properties" do @obj.simple.should be_nil @obj.simple_id.should be_nil end it "mass assignment by object" do @obj.update_attributes(:simple => @simple) @simple.id.should == @obj.simple_id end it "mass assignment by id" do @obj.update_attributes(:simple_id => @simple.id) @simple.id.should == @obj.simple_id end it "use different class name" do @obj.update_attributes(:some => @simple) @simple.should == @obj.some end it "parent and children" do child = BelongsToModel.find(BelongsToModel.create(:parent => @obj).id) @obj.should == child.parent @obj.id.should == child.parent_id end end
Version data entries
9 entries across 9 versions & 1 rubygems