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