mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-28 06:15:17 +00:00
Order cycles in specs comply with new date validations
This commit is contained in:
committed by
Maikel Linke
parent
ce56e667a4
commit
236ba9328d
@@ -516,7 +516,11 @@ feature %q{
|
||||
# Given three order cycles
|
||||
oc1 = create(:simple_order_cycle)
|
||||
oc2 = create(:simple_order_cycle)
|
||||
oc3 = create(:simple_order_cycle, orders_open_at: Time.zone.local(2040, 12, 12, 12, 12, 12))
|
||||
oc3 = create(:simple_order_cycle,
|
||||
orders_open_at: Time.zone.local(2040, 12, 12, 12, 12, 12),
|
||||
orders_close_at: Time.zone.local(2041, 12, 12, 12, 12, 12)
|
||||
)
|
||||
|
||||
|
||||
# When I go to the order cycles page
|
||||
login_to_admin_section
|
||||
|
||||
@@ -415,12 +415,12 @@ feature "As a consumer I want to shop with a distributor", js: true do
|
||||
page.should have_content "Orders are closed"
|
||||
end
|
||||
it "shows the last order cycle" do
|
||||
oc1 = create(:simple_order_cycle, distributors: [distributor], orders_close_at: 10.days.ago)
|
||||
oc1 = create(:simple_order_cycle, distributors: [distributor], orders_open_at: 17.days.ago, orders_close_at: 10.days.ago)
|
||||
visit shop_path
|
||||
page.should have_content "The last cycle closed 10 days ago"
|
||||
end
|
||||
it "shows the next order cycle" do
|
||||
oc1 = create(:simple_order_cycle, distributors: [distributor], orders_open_at: 10.days.from_now)
|
||||
oc1 = create(:simple_order_cycle, distributors: [distributor], orders_open_at: 10.days.from_now, orders_close_at: 17.days.from_now)
|
||||
visit shop_path
|
||||
page.should have_content "The next cycle opens in 10 days"
|
||||
end
|
||||
|
||||
@@ -318,7 +318,7 @@ describe Enterprise do
|
||||
s = create(:supplier_enterprise)
|
||||
d = create(:distributor_enterprise)
|
||||
p = create(:product)
|
||||
create(:simple_order_cycle, :orders_open_at => 10.days.from_now, suppliers: [s], distributors: [d], variants: [p.master])
|
||||
create(:simple_order_cycle, :orders_open_at => 10.days.from_now, orders_close_at: 17.days.from_now, suppliers: [s], distributors: [d], variants: [p.master])
|
||||
Enterprise.distributors_with_active_order_cycles.should_not include d
|
||||
end
|
||||
end
|
||||
|
||||
@@ -49,7 +49,7 @@ describe ProducerProperty do
|
||||
|
||||
describe "with a producer property for a product in a closed order cycle" do
|
||||
before do
|
||||
oc.update_attributes! orders_close_at: 1.week.ago
|
||||
oc.update_attributes! orders_open_at: 2.weeks.ago, orders_close_at: 1.week.ago
|
||||
end
|
||||
|
||||
it "doesn't return the producer property for .currently_sold_by" do
|
||||
|
||||
@@ -339,7 +339,7 @@ module Spree
|
||||
p1 = create(:product)
|
||||
p2 = create(:product)
|
||||
p3 = create(:product)
|
||||
oc2 = create(:simple_order_cycle, suppliers: [s], distributors: [d2], variants: [p2.master], orders_close_at: 1.day.ago)
|
||||
oc2 = create(:simple_order_cycle, suppliers: [s], distributors: [d2], variants: [p2.master], orders_open_at: 8.days.ago, orders_close_at: 1.day.ago)
|
||||
oc2 = create(:simple_order_cycle, suppliers: [s], distributors: [d3], variants: [p3.master], orders_close_at: Date.tomorrow)
|
||||
Product.in_an_active_order_cycle.should == [p3]
|
||||
end
|
||||
@@ -532,7 +532,7 @@ module Spree
|
||||
let!(:p) { create(:simple_product,
|
||||
variant_unit: 'weight',
|
||||
variant_unit_scale: 1,
|
||||
variant_unit_name: nil)
|
||||
variant_unit_name: nil)
|
||||
}
|
||||
|
||||
let!(:ot_volume) { create(:option_type, name: 'unit_volume', presentation: 'Volume') }
|
||||
|
||||
Reference in New Issue
Block a user