Skip to content

Commit

Permalink
CartItems need a Cart
Browse files Browse the repository at this point in the history
  • Loading branch information
thegcat committed Jun 16, 2017
1 parent 77f12fa commit 1d674c9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 4 additions & 1 deletion spec/models/pricing_spec.rb
Expand Up @@ -11,7 +11,10 @@
end

context 'there are currently blocked items' do
before {create_list(:cart_item, 2, pricing: pricing, quantity: 2)}
before do
cart = create(:cart)
create_list(:cart_item, 2, cart: cart, pricing: pricing, quantity: 2)
end
it {is_expected.to eq 6}
end
end
Expand Down
9 changes: 7 additions & 2 deletions spec/models/product_spec.rb
Expand Up @@ -28,8 +28,13 @@

context 'the product is in some carts' do
before do
create(:cart_item, pricing: product.pricings[0], quantity: 3)
create(:cart_item, pricing: product.pricings[1], quantity: 2)
cart = create(:cart)
create(
:cart_item, cart: cart, pricing: product.pricings[0], quantity: 3
)
create(
:cart_item, cart: cart, pricing: product.pricings[1], quantity: 2
)
end

it {is_expected.to eq 15}
Expand Down

0 comments on commit 1d674c9

Please sign in to comment.