spec/requests/main_spec.rb in merb-admin-0.5.7 vs spec/requests/main_spec.rb in merb-admin-0.6.0
- old
+ new
@@ -447,10 +447,11 @@
it "should create a new object" do
MerbAdmin::AbstractModel.new("Player").first.should_not be_nil
end
it "should be associated with the correct object" do
+ @draft.reload
MerbAdmin::AbstractModel.new("Player").first.draft.should == @draft
end
end
describe "create with has-many association", :given => "three teams exist" do
@@ -461,11 +462,13 @@
it "should create a new object" do
MerbAdmin::AbstractModel.new("League").first.should_not be_nil
end
it "should be associated with the correct objects" do
+ @teams[0].reload
MerbAdmin::AbstractModel.new("League").first.teams.should include(@teams[0])
+ @teams[1].reload
MerbAdmin::AbstractModel.new("League").first.teams.should include(@teams[1])
end
it "should be not associated with an incorrect object" do
MerbAdmin::AbstractModel.new("League").first.teams.should_not include(@teams[2])
@@ -542,10 +545,11 @@
it "should update an object that already exists" do
MerbAdmin::AbstractModel.new("Player").first.name.should eql("Jackie Robinson")
end
it "should be associated with the correct object" do
+ @draft.reload
MerbAdmin::AbstractModel.new("Player").first.draft.should == @draft
end
end
describe "update with has-many association", :given => "a league exists and three teams exist" do
@@ -556,10 +560,12 @@
it "should update an object that already exists" do
MerbAdmin::AbstractModel.new("League").first.name.should eql("National League")
end
it "should be associated with the correct objects" do
+ @teams[0].reload
MerbAdmin::AbstractModel.new("League").first.teams.should include(@teams[0])
+ @teams[1].reload
MerbAdmin::AbstractModel.new("League").first.teams.should include(@teams[1])
end
it "should not be associated with an incorrect object" do
MerbAdmin::AbstractModel.new("League").first.teams.should_not include(@teams[2])