Adds around block with time.freeze

This commit is contained in:
filipefurtad0
2022-08-08 12:23:11 +01:00
parent 116f503cf6
commit ce96094f49

View File

@@ -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