Skip to content

Commit

Permalink
[promo] make actions/create_line_items specs not depend on database o…
Browse files Browse the repository at this point in the history
…rdering

See broken build #1419.6 for the problems this caused in the past
  • Loading branch information
radar committed May 29, 2012
1 parent 177977d commit e21ef54
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions promo/spec/models/promotion/actions/create_line_items_spec.rb
Expand Up @@ -22,22 +22,25 @@
it "adds line items to order with correct variant and quantity" do
action.perform(:order => order)
order.line_items.count.should == 2
order.line_items.first.variant.should == @v1
order.line_items.first.quantity.should == 1
line_item = order.line_items.find_by_variant_id(@v1.id)
line_item.should_not be_nil
line_item.quantity.should == 1
end

it "only adds the delta of quantity to an order" do
order.add_variant(@v2, 1)
action.perform(:order => order)
order.line_items.first.variant.should == @v2
order.line_items.first.quantity.should == 2
line_item = order.line_items.find_by_variant_id(@v2.id)
line_item.should_not be_nil
line_item.quantity.should == 2
end

it "doesn't add if the quantity is greater" do
order.add_variant(@v2, 3)
action.perform(:order => order)
order.line_items.first.variant.should == @v2
order.line_items.first.quantity.should == 3
line_item = order.line_items.find_by_variant_id(@v2.id)
line_item.should_not be_nil
line_item.quantity.should == 3
end
end

Expand Down

0 comments on commit e21ef54

Please sign in to comment.