From 5f4ff4a8c09f7d87ed048049b4862e4b0d37e230 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Wed, 28 Mar 2018 12:01:50 +0800 Subject: [PATCH] Fix failing spec. --- spec/controllers/session_controller_spec.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/spec/controllers/session_controller_spec.rb b/spec/controllers/session_controller_spec.rb index 1f980a1fcb3..e06d85a523b 100644 --- a/spec/controllers/session_controller_spec.rb +++ b/spec/controllers/session_controller_spec.rb @@ -11,10 +11,12 @@ describe SessionController do describe '#become' do let!(:user) { Fabricate(:user) } - it "does not work when not in development mode" do - Rails.env.stubs(:development?).returns(false) + it "does not work when in production mode" do + Rails.env.stubs(:production?).returns(true) get :become, params: { session_id: user.username }, format: :json - expect(response).not_to be_redirect + + expect(response.status).to eq(403) + expect(JSON.parse(response.body)["error_type"]).to eq("invalid_access") expect(session[:current_user_id]).to be_blank end