Skip to content

Commit

Permalink
Fixing .build spec (for referenced docs)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacques Crocker committed Oct 19, 2010
1 parent 6f6e134 commit b84fc0d
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions spec/integration/mongoid/inheritance_spec.rb
Expand Up @@ -137,7 +137,7 @@
Browser.count.should == 2
Canvas.count.should == 3
end

it "deletes all documents except for those belonging to parent class collection" do
Firefox.delete_all
Firefox.count.should == 0
Expand Down Expand Up @@ -167,9 +167,9 @@
end

end

context "Creating references_many documents from a parent association" do

before do
@container = ShippingContainer.create
end
Expand All @@ -185,19 +185,23 @@
@container.vehicles << Truck.create({})
@container.vehicles.map(&:class).should == [Car,Truck]
end

it "should allow STI from the build call" do
@container.vehicles.build({},Car)
@container.vehicles.build({},Truck)
car = @container.vehicles.build({},Car)
car.save

truck = @container.vehicles.build({},Truck)
truck.save

@container.vehicles.map(&:class).should == [Car,Truck]
end

it "should allow STI from the build call" do
@container.vehicles.create({},Car)
@container.vehicles.create({},Truck)
@container.vehicles.map(&:class).should == [Car,Truck]
end

end

end

0 comments on commit b84fc0d

Please sign in to comment.