Improve order cycle specs' performance

This commit is contained in:
Arun Kumar Mohan
2020-09-25 22:42:45 -05:00
parent 6c27ac5f99
commit f5985de802

View File

@@ -288,7 +288,7 @@ describe OrderCycle do
end
describe "checking status" do
let(:oc) { create(:simple_order_cycle) }
let(:oc) { build_stubbed(:simple_order_cycle) }
it "reports status when an order cycle is upcoming" do
Timecop.freeze(oc.orders_open_at - 1.second) do
@@ -319,7 +319,8 @@ describe OrderCycle do
end
it "reports status when an order cycle is undated" do
oc.update!(orders_open_at: nil, orders_close_at: nil)
oc.orders_open_at = nil
oc.orders_close_at = nil
expect(oc).to be_undated
expect(oc).not_to be_dated
@@ -329,7 +330,7 @@ describe OrderCycle do
end
it "reports status when an order cycle is partially dated - opening time only" do
oc.update!(orders_close_at: nil)
oc.orders_close_at = nil
expect(oc).to be_undated
expect(oc).not_to be_dated
@@ -339,7 +340,7 @@ describe OrderCycle do
end
it "reports status when an order cycle is partially dated - closing time only" do
oc.update!(orders_open_at: nil)
oc.orders_open_at = nil
expect(oc).to be_undated
expect(oc).not_to be_dated