diff options
author | Stan Hu <stanhu@gmail.com> | 2015-06-16 00:00:55 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2015-07-06 09:47:22 -0700 |
commit | 4254f09eaa851d867f440420d719313dd2f13f82 (patch) | |
tree | 624db9a06dd7c76af02bec055f7af2aeb1f5c16e /spec | |
parent | e2190115e860686c4ec3a3b9e809257ef8d9265b (diff) | |
download | gitlab-ce-4254f09eaa851d867f440420d719313dd2f13f82.tar.gz |
Return 40x error codes if branch could not be deleted in UI
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/branches_controller_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/controllers/branches_controller_spec.rb b/spec/controllers/branches_controller_spec.rb index db3b64babcd..bd4c946b64b 100644 --- a/spec/controllers/branches_controller_spec.rb +++ b/spec/controllers/branches_controller_spec.rb @@ -55,4 +55,30 @@ describe Projects::BranchesController do it { is_expected.to render_template('new') } end end + + describe "POST destroy" do + render_views + + before do + post :destroy, + format: :js, + id: branch, + namespace_id: project.namespace.to_param, + project_id: project.to_param + end + + context "valid branch name, valid source" do + let(:branch) { "feature" } + + it { expect(response.status).to eq(200) } + it { expect(subject).to render_template('destroy') } + end + + context "invalid branch name, valid ref" do + let(:branch) { "no-branch" } + + it { expect(response.status).to eq(404) } + it { expect(subject).to render_template('destroy') } + end + end end |