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. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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) > endThen write the missing method. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Robert Walker 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. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.