From 349b7de11a875382e4c76507a6a35b2d3fac9a85 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Fri, 28 Nov 2014 14:02:55 +1100 Subject: [PATCH] Using simple_order_cycle Before: 2 minutes 58.3 seconds After: 35.04 seconds --- spec/controllers/shop_controller_spec.rb | 26 ++++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/spec/controllers/shop_controller_spec.rb b/spec/controllers/shop_controller_spec.rb index f1c132bb24..bfa68da912 100644 --- a/spec/controllers/shop_controller_spec.rb +++ b/spec/controllers/shop_controller_spec.rb @@ -16,21 +16,21 @@ describe ShopController do describe "Selecting order cycles" do it "should select an order cycle when only one order cycle is open" do - oc1 = create(:order_cycle, distributors: [d]) + oc1 = create(:simple_order_cycle, distributors: [d]) spree_get :show controller.current_order_cycle.should == oc1 end it "should not set an order cycle when multiple order cycles are open" do - oc1 = create(:order_cycle, distributors: [d]) - oc2 = create(:order_cycle, distributors: [d]) + oc1 = create(:simple_order_cycle, distributors: [d]) + oc2 = create(:simple_order_cycle, distributors: [d]) spree_get :show controller.current_order_cycle.should == nil end it "should allow the user to post to select the current order cycle" do - oc1 = create(:order_cycle, distributors: [d]) - oc2 = create(:order_cycle, distributors: [d]) + oc1 = create(:simple_order_cycle, distributors: [d]) + oc2 = create(:simple_order_cycle, distributors: [d]) spree_post :order_cycle, order_cycle_id: oc2.id response.should be_success @@ -40,8 +40,8 @@ describe ShopController do context "RABL tests" do render_views it "should return the order cycle details when the oc is selected" do - oc1 = create(:order_cycle, distributors: [d]) - oc2 = create(:order_cycle, distributors: [d]) + oc1 = create(:simple_order_cycle, distributors: [d]) + oc2 = create(:simple_order_cycle, distributors: [d]) spree_post :order_cycle, order_cycle_id: oc2.id response.should be_success @@ -49,7 +49,7 @@ describe ShopController do end it "should return the current order cycle when hit with GET" do - oc1 = create(:order_cycle, distributors: [d]) + oc1 = create(:simple_order_cycle, distributors: [d]) controller.stub(:current_order_cycle).and_return oc1 spree_get :order_cycle response.body.should have_content oc1.id @@ -57,9 +57,9 @@ describe ShopController do end it "should not allow the user to select an invalid order cycle" do - oc1 = create(:order_cycle, distributors: [d]) - oc2 = create(:order_cycle, distributors: [d]) - oc3 = create(:order_cycle, distributors: [create(:distributor_enterprise)]) + oc1 = create(:simple_order_cycle, distributors: [d]) + oc2 = create(:simple_order_cycle, distributors: [d]) + oc3 = create(:simple_order_cycle, distributors: [create(:distributor_enterprise)]) spree_post :order_cycle, order_cycle_id: oc3.id response.status.should == 404 @@ -71,7 +71,7 @@ describe ShopController do describe "producers/suppliers" do let(:supplier) { create(:supplier_enterprise) } let(:product) { create(:product, supplier: supplier) } - let(:order_cycle) { create(:order_cycle, distributors: [d], coordinator: create(:distributor_enterprise)) } + let(:order_cycle) { create(:simple_order_cycle, distributors: [d], coordinator: create(:distributor_enterprise)) } before do exchange = Exchange.find(order_cycle.exchanges.to_enterprises(d).outgoing.first.id) @@ -81,7 +81,7 @@ describe ShopController do describe "returning products" do let(:product) { create(:product) } - let(:order_cycle) { create(:order_cycle, distributors: [d], coordinator: create(:distributor_enterprise)) } + let(:order_cycle) { create(:simple_order_cycle, distributors: [d], coordinator: create(:distributor_enterprise)) } let(:exchange) { Exchange.find(order_cycle.exchanges.to_enterprises(d).outgoing.first.id) } before do