summaryrefslogtreecommitdiff
path: root/spec/controllers/projects/forks_controller_spec.rb
diff options
context:
space:
mode:
authorMarkus Koller <mkoller@gitlab.com>2019-06-20 19:45:01 +0200
committerMarkus Koller <mkoller@gitlab.com>2019-06-25 13:19:30 +0200
commitdb132bae1d0098dce835844bfa667c5377510d3c (patch)
tree0b690d78e0251ab6010e76aea7960a2f815b8935 /spec/controllers/projects/forks_controller_spec.rb
parent8fd2c08472afc3846ba28f97994a57143bc76eaf (diff)
downloadgitlab-ce-db132bae1d0098dce835844bfa667c5377510d3c.tar.gz
Support redirect paths starting with a dash51952-forking-via-webide
We use a leading dash for certain things like the WebIDE, which had the side effect of losing the `params[:continue][:to]` param when opening the WebIDE on a project where the user doesn't have push access and therefore needs to fork the project first.
Diffstat (limited to 'spec/controllers/projects/forks_controller_spec.rb')
-rw-r--r--spec/controllers/projects/forks_controller_spec.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/spec/controllers/projects/forks_controller_spec.rb b/spec/controllers/projects/forks_controller_spec.rb
index 3423fdf4c41..5ac5279e997 100644
--- a/spec/controllers/projects/forks_controller_spec.rb
+++ b/spec/controllers/projects/forks_controller_spec.rb
@@ -115,24 +115,34 @@ describe Projects::ForksController do
end
describe 'POST create' do
- def post_create
+ def post_create(params = {})
post :create,
params: {
namespace_id: project.namespace,
project_id: project,
namespace_key: user.namespace.id
- }
+ }.merge(params)
end
context 'when user is signed in' do
- it 'responds with status 302' do
+ before do
sign_in(user)
+ end
+ it 'responds with status 302' do
post_create
expect(response).to have_gitlab_http_status(302)
expect(response).to redirect_to(namespace_project_import_path(user.namespace, project))
end
+
+ it 'passes continue params to the redirect' do
+ continue_params = { to: '/-/ide/project/path', notice: 'message' }
+ post_create continue: continue_params
+
+ expect(response).to have_gitlab_http_status(302)
+ expect(response).to redirect_to(namespace_project_import_path(user.namespace, project, continue: continue_params))
+ end
end
context 'when user is not signed in' do