mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-31 21:37:16 +00:00
Remove specs that are no longer relevant - distribution selection on product page no longer present
This commit is contained in:
@@ -27,44 +27,7 @@ feature %q{
|
||||
Spree::Order.last.line_items.should be_empty
|
||||
end
|
||||
|
||||
scenario "adding the first product to the cart", :future => true do
|
||||
# Given a product, some distributors and a defined shipping cost
|
||||
d1 = create(:distributor_enterprise, :name => "Green Grass")
|
||||
d2 = create(:distributor_enterprise, :name => "AusFarmers United")
|
||||
create(:product, :distributors => [d2])
|
||||
p = create(:product, :price => 12.34)
|
||||
create(:product_distribution, :product => p, :distributor => d1)
|
||||
|
||||
# ... with a flat rate distribution fee of $1.23
|
||||
ef = p.product_distributions.first.enterprise_fee
|
||||
ef.calculator = Spree::Calculator::FlatRate.new preferred_amount: 1.23
|
||||
ef.calculator.save!
|
||||
|
||||
# When I choose a distributor
|
||||
visit spree.root_path
|
||||
click_on "AusFarmers United"
|
||||
|
||||
# And I add an item to my cart from a different distributor
|
||||
visit spree.product_path p
|
||||
select(d1.name, :from => 'distributor_id')
|
||||
click_button 'Add To Cart'
|
||||
|
||||
# Then the correct totals should be displayed
|
||||
page.should have_selector 'span.item-total', :text => '$12.34'
|
||||
page.should have_selector 'span.distribution-total', :text => '$1.23'
|
||||
page.should have_selector 'span.grand-total', :text => '$13.57'
|
||||
|
||||
# And the item should be in my cart
|
||||
order = Spree::Order.last
|
||||
line_item = order.line_items.first
|
||||
line_item.product.should == p
|
||||
|
||||
# And my order should have its distributor set to the chosen distributor
|
||||
order.distributor.should == d1
|
||||
end
|
||||
|
||||
context "adding a subsequent product to the cart" do
|
||||
|
||||
it "does not allow the user to add a product from a distributor that cannot supply the cart's products" do
|
||||
# Given two products, each at a different distributor
|
||||
d1 = create(:distributor_enterprise)
|
||||
|
||||
@@ -279,25 +279,6 @@ feature %q{
|
||||
page.should have_selector "input[value='#{@oc1.id}'][checked='checked']"
|
||||
page.should have_selector "option[value='#{@d1.id}'][selected='selected']"
|
||||
end
|
||||
|
||||
scenario "selection form is not shown when there are products in the cart" do
|
||||
# Given a product
|
||||
d = create(:distributor_enterprise)
|
||||
p = create(:product, :distributors => [d])
|
||||
|
||||
# When I go to the products listing page, I should see the selection form
|
||||
visit spree.products_path
|
||||
page.should have_selector "#distribution-selection"
|
||||
|
||||
# When I add a product to the cart
|
||||
visit spree.product_path p
|
||||
select d.name, :from => 'distributor_id'
|
||||
click_button 'Add To Cart'
|
||||
|
||||
# Then I should no longer see the selection form
|
||||
visit spree.products_path
|
||||
page.should_not have_selector "#distribution-selection"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -51,24 +51,5 @@ feature %q{
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "with Javascript", js: true do
|
||||
it "changes distributor details when the distributor is changed" do
|
||||
d1 = create(:distributor_enterprise)
|
||||
d2 = create(:distributor_enterprise)
|
||||
d3 = create(:distributor_enterprise)
|
||||
p = create(:product, :distributors => [d1, d2, d3])
|
||||
|
||||
visit spree.product_path p
|
||||
|
||||
[d1, d2, d3].each do |d|
|
||||
select d.name, :from => 'distributor_id'
|
||||
|
||||
within '#product-distributor-details' do
|
||||
page.should have_selector 'h2', :text => d.name
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user