mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-02 21:57:17 +00:00
25 lines
840 B
Ruby
25 lines
840 B
Ruby
require 'spec_helper'
|
|
|
|
describe Spree::OrdersController do
|
|
context "adding the first product to the cart" do
|
|
it "does not add the product if the user does not specify a distributor" do
|
|
create(:distributor)
|
|
p = create(:product)
|
|
|
|
expect do
|
|
spree_put :populate, :variants => {p.id => 1}
|
|
end.to change(Spree::LineItem, :count).by(0)
|
|
end
|
|
|
|
it "does not add the product if the user specifies a distributor that the product is not available at" do
|
|
distributor_product = create(:distributor)
|
|
distributor_no_product = create(:distributor)
|
|
p = create(:product, :distributors => [distributor_product])
|
|
|
|
expect do
|
|
spree_put :populate, :variants => {p.id => 1}, :distributor_id => distributor_no_product.id
|
|
end.to change(Spree::LineItem, :count).by(0)
|
|
end
|
|
end
|
|
end
|