From 5dd7ddc2884a2decf61139baf9da2b6422ef1864 Mon Sep 17 00:00:00 2001 From: Julius Pabrinkis Date: Thu, 27 Apr 2017 16:19:02 +0100 Subject: [PATCH] Refactor base controller with new rspec syntax --- spec/controllers/base_controller_spec.rb | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/spec/controllers/base_controller_spec.rb b/spec/controllers/base_controller_spec.rb index 166fc091c0..6da68b59e1 100644 --- a/spec/controllers/base_controller_spec.rb +++ b/spec/controllers/base_controller_spec.rb @@ -10,17 +10,16 @@ describe BaseController, :type => :controller do end it "redirects to home with message if order cycle is expired" do - controller.stub(:current_order_cycle).and_return(oc) - controller.stub(:current_order).and_return(order) - oc.stub(:closed?).and_return(true) - - order.should_receive(:empty!) - order.should_receive(:set_order_cycle!).with(nil) + expect(controller).to receive(:current_order_cycle).and_return(oc).twice + expect(controller).to receive(:current_order).and_return(order).twice + expect(oc).to receive(:closed?).and_return(true) + expect(order).to receive(:empty!) + expect(order).to receive(:set_order_cycle!).with(nil) get :index - session[:expired_order_cycle_id].should == oc.id - response.should redirect_to root_url - flash[:info].should == "The order cycle you've selected has just closed. Please try again!" + expect(session[:expired_order_cycle_id]).to eq oc.id + expect(response).to redirect_to root_url + expect(flash[:info]).to eq "The order cycle you've selected has just closed. Please try again!" end end