From 116a220ca2f931bbbb1377fd06ce88c5900025e3 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 3 Apr 2019 12:53:39 +0300 Subject: Extract move quick action spec to shared example --- .../issues/user_uses_quick_actions_spec.rb | 121 +-------------------- 1 file changed, 1 insertion(+), 120 deletions(-) (limited to 'spec/features/issues/user_uses_quick_actions_spec.rb') diff --git a/spec/features/issues/user_uses_quick_actions_spec.rb b/spec/features/issues/user_uses_quick_actions_spec.rb index a9157ccaaa3..86b15b1d980 100644 --- a/spec/features/issues/user_uses_quick_actions_spec.rb +++ b/spec/features/issues/user_uses_quick_actions_spec.rb @@ -63,125 +63,6 @@ describe 'Issues > User uses quick actions', :js do it_behaves_like 'duplicate quick action' it_behaves_like 'create_merge_request quick action' it_behaves_like 'due quick action' - - describe 'move the issue to another project' do - let(:issue) { create(:issue, project: project) } - - context 'when the project is valid' do - let(:target_project) { create(:project, :public) } - - before do - target_project.add_maintainer(user) - gitlab_sign_out - sign_in(user) - visit project_issue_path(project, issue) - wait_for_requests - end - - it 'moves the issue' do - add_note("/move #{target_project.full_path}") - - expect(page).to have_content 'Commands applied' - expect(issue.reload).to be_closed - - visit project_issue_path(target_project, issue) - - expect(page).to have_content 'Issues 1' - end - end - - context 'when the project is valid but the user not authorized' do - let(:project_unauthorized) { create(:project, :public) } - - before do - gitlab_sign_out - sign_in(user) - visit project_issue_path(project, issue) - wait_for_requests - end - - it 'does not move the issue' do - add_note("/move #{project_unauthorized.full_path}") - - wait_for_requests - - expect(page).to have_content 'Commands applied' - expect(issue.reload).to be_open - end - end - - context 'when the project is invalid' do - before do - gitlab_sign_out - sign_in(user) - visit project_issue_path(project, issue) - wait_for_requests - end - - it 'does not move the issue' do - add_note("/move not/valid") - - wait_for_requests - - expect(page).to have_content 'Commands applied' - expect(issue.reload).to be_open - end - end - - context 'when the user issues multiple commands' do - let(:target_project) { create(:project, :public) } - let(:milestone) { create(:milestone, title: '1.0', project: project) } - let(:target_milestone) { create(:milestone, title: '1.0', project: target_project) } - let(:bug) { create(:label, project: project, title: 'bug') } - let(:wontfix) { create(:label, project: project, title: 'wontfix') } - let(:bug_target) { create(:label, project: target_project, title: 'bug') } - let(:wontfix_target) { create(:label, project: target_project, title: 'wontfix') } - - before do - target_project.add_maintainer(user) - gitlab_sign_out - sign_in(user) - visit project_issue_path(project, issue) - end - - it 'applies the commands to both issues and moves the issue' do - add_note("/label ~#{bug.title} ~#{wontfix.title}\n\n/milestone %\"#{milestone.title}\"\n\n/move #{target_project.full_path}") - - expect(page).to have_content 'Commands applied' - expect(issue.reload).to be_closed - - visit project_issue_path(target_project, issue) - - expect(page).to have_content 'bug' - expect(page).to have_content 'wontfix' - expect(page).to have_content '1.0' - - visit project_issue_path(project, issue) - expect(page).to have_content 'Closed' - expect(page).to have_content 'bug' - expect(page).to have_content 'wontfix' - expect(page).to have_content '1.0' - end - - it 'moves the issue and applies the commands to both issues' do - add_note("/move #{target_project.full_path}\n\n/label ~#{bug.title} ~#{wontfix.title}\n\n/milestone %\"#{milestone.title}\"") - - expect(page).to have_content 'Commands applied' - expect(issue.reload).to be_closed - - visit project_issue_path(target_project, issue) - - expect(page).to have_content 'bug' - expect(page).to have_content 'wontfix' - expect(page).to have_content '1.0' - - visit project_issue_path(project, issue) - expect(page).to have_content 'Closed' - expect(page).to have_content 'bug' - expect(page).to have_content 'wontfix' - expect(page).to have_content '1.0' - end - end - end + it_behaves_like 'move quick action' end end -- cgit v1.2.1