diff options
Diffstat (limited to 'spec/controllers/projects/branches_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/branches_controller_spec.rb | 56 |
1 files changed, 19 insertions, 37 deletions
diff --git a/spec/controllers/projects/branches_controller_spec.rb b/spec/controllers/projects/branches_controller_spec.rb index 85d3044993e..174d8904481 100644 --- a/spec/controllers/projects/branches_controller_spec.rb +++ b/spec/controllers/projects/branches_controller_spec.rb @@ -124,57 +124,39 @@ describe Projects::BranchesController do ) end - context 'create_confidential_merge_request feature is enabled' do + context 'user cannot update issue' do + let(:issue) { create(:issue, project: confidential_issue_project) } + + it 'does not post a system note' do + expect(SystemNoteService).not_to receive(:new_issue_branch) + + create_branch_with_confidential_issue_project + end + end + + context 'user can update issue' do before do - stub_feature_flags(create_confidential_merge_request: true) + confidential_issue_project.add_reporter(user) end - context 'user cannot update issue' do + context 'issue is under the specified project' do let(:issue) { create(:issue, project: confidential_issue_project) } - it 'does not post a system note' do - expect(SystemNoteService).not_to receive(:new_issue_branch) + it 'posts a system note' do + expect(SystemNoteService).to receive(:new_issue_branch).with(issue, confidential_issue_project, user, "1-feature-branch", branch_project: project) create_branch_with_confidential_issue_project end end - context 'user can update issue' do - before do - confidential_issue_project.add_reporter(user) - end - - context 'issue is under the specified project' do - let(:issue) { create(:issue, project: confidential_issue_project) } - - it 'posts a system note' do - expect(SystemNoteService).to receive(:new_issue_branch).with(issue, confidential_issue_project, user, "1-feature-branch", branch_project: project) - - create_branch_with_confidential_issue_project - end - end - - context 'issue is not under the specified project' do - it 'does not post a system note' do - expect(SystemNoteService).not_to receive(:new_issue_branch) + context 'issue is not under the specified project' do + it 'does not post a system note' do + expect(SystemNoteService).not_to receive(:new_issue_branch) - create_branch_with_confidential_issue_project - end + create_branch_with_confidential_issue_project end end end - - context 'create_confidential_merge_request feature is disabled' do - before do - stub_feature_flags(create_confidential_merge_request: false) - end - - it 'posts a system note on project' do - expect(SystemNoteService).to receive(:new_issue_branch).with(issue, project, user, "1-feature-branch", branch_project: project) - - create_branch_with_confidential_issue_project - end - end end context 'repository-less project' do |