I have 3 models: Store, Product and Item
How do i get this test to pass?
it “should update item’s quantity” do
Item.create(:product_id => 1, :store_id => 1, :quantity => 1)
Item.create(:product_id => 1, :store_id => 1, :quantity => 1)
Item.first.quantity.should eql(2)
end
I have a better picture of the situation on Pastie:
http://pastie.org/997850
Cheers.
Marcelo wrote:
I have 3 models: Store, Product and Item
How do i get this test to pass?
it “should update item’s quantity” do
Item.create(:product_id => 1, :store_id => 1, :quantity => 1)
Item.create(:product_id => 1, :store_id => 1, :quantity => 1)
Item.first.quantity.should eql(2)
end
I have a better picture of the situation on Pastie:
http://pastie.org/997850
it “should update item’s quantity” do
Item.create_or_update_quantity(:product_id => 1, :store_id => 1, :quantity => 1)
Item.create_or_update_quantity(:product_id => 1, :store_id => 1, :quantity => 1)
Item.first.quantity.should eql(2)
end
Then write the missing method.
Robert W. wrote:
it “should update item’s quantity” do
Item.create_or_update_quantity(:product_id => 1, :store_id => 1, :quantity => 1)
Item.create_or_update_quantity(:product_id => 1, :store_id => 1, :quantity => 1)
Item.first.quantity.should eql(2)
end
Then write the missing method.
Ugh! Sorry for the duplicate quoting… didn’t mean to do that.