diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 07:33:21 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 07:33:21 +0000 |
commit | 36a59d088eca61b834191dacea009677a96c052f (patch) | |
tree | e4f33972dab5d8ef79e3944a9f403035fceea43f /spec/controllers/projects/branches_controller_spec.rb | |
parent | a1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff) | |
download | gitlab-ce-15.0.0-rc42.tar.gz |
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'spec/controllers/projects/branches_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/branches_controller_spec.rb | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/spec/controllers/projects/branches_controller_spec.rb b/spec/controllers/projects/branches_controller_spec.rb index 1580ad9361d..ed11d5936b0 100644 --- a/spec/controllers/projects/branches_controller_spec.rb +++ b/spec/controllers/projects/branches_controller_spec.rb @@ -307,17 +307,36 @@ RSpec.describe Projects::BranchesController do sign_in(developer) end - it 'returns 303' do - post :destroy, - format: :html, - params: { - id: 'foo/bar/baz', - namespace_id: project.namespace, - project_id: project - } + subject(:post_request) do + post :destroy, format: :html, params: { + id: 'foo/bar/baz', + namespace_id: project.namespace, + project_id: project + } + end + it "returns response code 303" do + post_request expect(response).to have_gitlab_http_status(:see_other) end + + context 'with http referer' do + before do + request.env['HTTP_REFERER'] = '/' + end + + it "redirects to the referer path" do + post_request + expect(response).to redirect_to('/') + end + end + + context 'without http referer' do + it "redirects to the project branches path" do + post_request + expect(response).to redirect_to(project_branches_path(project)) + end + end end describe "POST destroy" do |