mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-18 00:17:25 +00:00
Get tests broken because of new order cycle shipping method validations working again
This commit is contained in:
committed by
Filipe
parent
a46b77d10c
commit
4e0bf75ecf
@@ -10,7 +10,10 @@ describe "Shops caching", js: true, caching: true do
|
||||
create(:distributor_enterprise, with_payment_and_shipping: true, is_primary_producer: true)
|
||||
}
|
||||
let!(:order_cycle) {
|
||||
create(:open_order_cycle, distributors: [distributor], coordinator: distributor)
|
||||
create(:open_order_cycle,
|
||||
distributors: [distributor],
|
||||
coordinator: distributor,
|
||||
shipping_methods: [distributor.shipping_methods.first])
|
||||
}
|
||||
|
||||
describe "caching enterprises AMS data" do
|
||||
|
||||
@@ -14,7 +14,9 @@ describe "As a consumer I want to check out my cart", js: true do
|
||||
let(:supplier) { create(:supplier_enterprise) }
|
||||
let!(:order_cycle) {
|
||||
create(:simple_order_cycle, distributors: [distributor],
|
||||
coordinator: create(:distributor_enterprise), variants: [product.variants.first])
|
||||
coordinator: create(:distributor_enterprise),
|
||||
shipping_methods: [distributor.shipping_methods.first],
|
||||
variants: [product.variants.first])
|
||||
}
|
||||
let(:product) { create(:simple_product, supplier: supplier) }
|
||||
let(:order) { create(:order, order_cycle: order_cycle, distributor: distributor) }
|
||||
|
||||
@@ -42,6 +42,7 @@ describe "Check out with Paypal", js: true do
|
||||
|
||||
before do
|
||||
distributor.shipping_methods << free_shipping
|
||||
order_cycle.shipping_methods << free_shipping
|
||||
set_order order
|
||||
add_product_to_cart order, product
|
||||
end
|
||||
|
||||
@@ -65,9 +65,9 @@ describe "As a consumer I want to check out my cart", js: true do
|
||||
set_order order
|
||||
add_product_to_cart order, product
|
||||
|
||||
distributor.shipping_methods << free_shipping
|
||||
distributor.shipping_methods << shipping_with_fee
|
||||
distributor.shipping_methods << tagged_shipping
|
||||
shipping_methods = [free_shipping, shipping_with_fee, tagged_shipping]
|
||||
distributor.shipping_methods << shipping_methods
|
||||
order_cycle.shipping_methods << shipping_methods
|
||||
end
|
||||
|
||||
describe "when I have an out of stock product in my cart" do
|
||||
|
||||
@@ -34,7 +34,9 @@ describe "Check out with Stripe", js: true do
|
||||
setup_stripe
|
||||
set_order order
|
||||
add_product_to_cart order, product
|
||||
distributor.shipping_methods << [shipping_with_fee, free_shipping]
|
||||
shipping_methods = [shipping_with_fee, free_shipping]
|
||||
distributor.shipping_methods << shipping_methods
|
||||
order_cycle.shipping_methods << shipping_methods
|
||||
end
|
||||
|
||||
describe "using Stripe SCA" do
|
||||
|
||||
@@ -18,7 +18,9 @@ describe "As a consumer I want to view products", js: true do
|
||||
let(:supplier) { create(:supplier_enterprise) }
|
||||
let(:oc1) {
|
||||
create(:simple_order_cycle, distributors: [distributor],
|
||||
coordinator: create(:distributor_enterprise), orders_close_at: 2.days.from_now)
|
||||
coordinator: create(:distributor_enterprise),
|
||||
orders_close_at: 2.days.from_now,
|
||||
shipping_methods: [distributor.shipping_methods.first])
|
||||
}
|
||||
let(:product) {
|
||||
create(:simple_product, supplier: supplier, primary_taxon: taxon, properties: [property], name: "Beans")
|
||||
|
||||
@@ -14,11 +14,15 @@ describe "As a consumer I want to shop with a distributor", js: true do
|
||||
let(:supplier) { create(:supplier_enterprise) }
|
||||
let(:oc1) {
|
||||
create(:simple_order_cycle, distributors: [distributor],
|
||||
coordinator: create(:distributor_enterprise), orders_close_at: 2.days.from_now)
|
||||
coordinator: create(:distributor_enterprise),
|
||||
orders_close_at: 2.days.from_now,
|
||||
shipping_methods: [distributor.shipping_methods.first])
|
||||
}
|
||||
let(:oc2) {
|
||||
create(:simple_order_cycle, distributors: [distributor],
|
||||
coordinator: create(:distributor_enterprise), orders_close_at: 3.days.from_now)
|
||||
coordinator: create(:distributor_enterprise),
|
||||
orders_close_at: 3.days.from_now,
|
||||
shipping_methods: [distributor.shipping_methods.first])
|
||||
}
|
||||
let(:product) { create(:simple_product, supplier: supplier, meta_keywords: "Domestic") }
|
||||
let(:variant) { product.variants.first }
|
||||
|
||||
@@ -12,7 +12,9 @@ describe "As a consumer, I want to check unit price information for a product",
|
||||
let(:supplier) { create(:supplier_enterprise) }
|
||||
let(:oc1) {
|
||||
create(:simple_order_cycle, distributors: [distributor],
|
||||
coordinator: create(:distributor_enterprise), orders_close_at: 2.days.from_now)
|
||||
coordinator: create(:distributor_enterprise),
|
||||
orders_close_at: 2.days.from_now,
|
||||
shipping_methods: [distributor.shipping_methods.first])
|
||||
}
|
||||
let(:product) { create(:simple_product, supplier: supplier) }
|
||||
let(:variant) { product.variants.first }
|
||||
|
||||
@@ -12,7 +12,8 @@ describe "shopping with variant overrides defined", js: true do
|
||||
let(:hub) { create(:distributor_enterprise, with_payment_and_shipping: true) }
|
||||
let(:producer) { create(:supplier_enterprise) }
|
||||
let(:oc) {
|
||||
create(:simple_order_cycle, suppliers: [producer], coordinator: hub, distributors: [hub])
|
||||
create(:simple_order_cycle,
|
||||
suppliers: [producer], coordinator: hub, distributors: [hub], shipping_methods: [sm])
|
||||
}
|
||||
let(:outgoing_exchange) { oc.exchanges.outgoing.first }
|
||||
let(:sm) { hub.shipping_methods.first }
|
||||
|
||||
@@ -71,7 +71,8 @@ describe "As a consumer, I want to checkout my order", js: true do
|
||||
add_enterprise_fee enterprise_fee
|
||||
set_order order
|
||||
|
||||
distributor.shipping_methods.push(shipping_methods)
|
||||
distributor.shipping_methods << shipping_methods
|
||||
order_cycle.shipping_methods << shipping_methods
|
||||
end
|
||||
|
||||
context "guest checkout when distributor doesn't allow guest orders" do
|
||||
|
||||
Reference in New Issue
Block a user