From 18c83239871e5028526d44f18ec11b71cdd1e2c0 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Mon, 19 Dec 2016 18:12:15 +0800 Subject: [PATCH] FIX: Incorrect path for redirect. --- app/controllers/safe_mode_controller.rb | 2 +- spec/integration/safe_mode_spec.rb | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 spec/integration/safe_mode_spec.rb diff --git a/app/controllers/safe_mode_controller.rb b/app/controllers/safe_mode_controller.rb index d414f141b7a..e52161cff20 100644 --- a/app/controllers/safe_mode_controller.rb +++ b/app/controllers/safe_mode_controller.rb @@ -14,7 +14,7 @@ class SafeModeController < ApplicationController if safe_mode.length > 0 redirect_to path("/?safe_mode=#{safe_mode.join("%2C")}") else - redirect_to :index + redirect_to safe_mode_path end end end diff --git a/spec/integration/safe_mode_spec.rb b/spec/integration/safe_mode_spec.rb new file mode 100644 index 00000000000..f421c8fb976 --- /dev/null +++ b/spec/integration/safe_mode_spec.rb @@ -0,0 +1,13 @@ +require 'rails_helper' + +RSpec.describe 'Safe mode' do + describe 'entering safe mode' do + context 'when no params are given' do + it 'should redirect back to safe mode page' do + post '/safe-mode' + + expect(response.status).to redirect_to(safe_mode_path) + end + end + end +end