summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-05-19 19:55:56 +0000
committerDouwe Maan <douwe@gitlab.com>2017-05-19 19:55:56 +0000
commit776d4ba5c99d2d15bf3759a35f515fdb4406af56 (patch)
tree88d81c13bb154f6456f4a26b8300619a7da218cf /spec
parent5460153c9f1a0b1679e4f31f1d588cb77857b714 (diff)
parent49ded5c1fa31abf004d85f369e8b464879bbd781 (diff)
downloadgitlab-ce-776d4ba5c99d2d15bf3759a35f515fdb4406af56.tar.gz
Merge branch 'fix-json-endpoint-redirection' into 'master'
Bugfix: don't redirect to JSON endpoints after sign in See merge request !11561
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/projects/issues_controller_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb
index 1f79e72495a..04afd07c59e 100644
--- a/spec/controllers/projects/issues_controller_spec.rb
+++ b/spec/controllers/projects/issues_controller_spec.rb
@@ -156,6 +156,32 @@ describe Projects::IssuesController do
end
end
+ describe 'Redirect after sign in' do
+ context 'with an AJAX request' do
+ it 'does not store the visited URL' do
+ xhr :get,
+ :show,
+ format: :json,
+ namespace_id: project.namespace,
+ project_id: project,
+ id: issue.iid
+
+ expect(session['user_return_to']).to be_blank
+ end
+ end
+
+ context 'without an AJAX request' do
+ it 'stores the visited URL' do
+ get :show,
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ id: issue.iid
+
+ expect(session['user_return_to']).to eq("/#{project.namespace.to_param}/#{project.to_param}/issues/#{issue.iid}")
+ end
+ end
+ end
+
describe 'PUT #update' do
before do
sign_in(user)