diff --git a/spec/system/admin/reports/packing_report_spec.rb b/spec/system/admin/reports/packing_report_spec.rb index 489df66e78..b5a1f4d1e5 100644 --- a/spec/system/admin/reports/packing_report_spec.rb +++ b/spec/system/admin/reports/packing_report_spec.rb @@ -6,6 +6,13 @@ describe "Packing Reports" do include AuthenticationHelper include WebHelper + around do |example| + Timecop.freeze(Time.zone.now.strftime("%Y-%m-%d 00:00")) { example.run } + end + + let!(:open_datetime) { (Time.zone.now - 1.month).strftime("%Y-%m-%d 00:00") } + let!(:close_datetime) { Time.zone.now.strftime("%Y-%m-%d 00:00") } + describe "Packing reports" do before do login_as_admin @@ -32,9 +39,6 @@ describe "Packing Reports" do let(:variant2) { create(:variant, product: product1, unit_description: "Small") } let(:product2) { create(:simple_product, name: "Product 2", supplier: supplier) } - let(:open_datetime) { (Time.zone.now - 1.month).strftime("%Y-%m-%d 00:00") } - let(:close_datetime) { Time.zone.now.strftime("%Y-%m-%d 00:00") } - before do order1.finalize! order2.finalize! @@ -115,9 +119,6 @@ describe "Packing Reports" do let(:li1) { build(:line_item_with_shipment) } let(:li2) { build(:line_item_with_shipment) } - let(:open_datetime) { (Time.zone.now - 1.month).strftime("%Y-%m-%d 00:00") } - let(:close_datetime) { Time.zone.now.strftime("%Y-%m-%d 00:00") } - before do order.line_items << li1 order.line_items << li2