diff options
author | Sean McGivern <sean@gitlab.com> | 2019-04-08 07:54:25 +0000 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-04-08 07:54:25 +0000 |
commit | 435c492bac54f588b92e733b632edd4149a6db37 (patch) | |
tree | 2dbe22dacfac249ebffea399ea696c98b569f75e /spec/support/shared_examples | |
parent | ddf3edc7a956dbf54115fd141c81b4b2f7a655b4 (diff) | |
parent | 42fe7e91b3d306596a92b9103ccbdf900493a50a (diff) | |
download | gitlab-ce-435c492bac54f588b92e733b632edd4149a6db37.tar.gz |
Merge branch '59570-wip-quick-action' into 'master'
Extract w-i-p quick action to a shared example
Closes #59570
See merge request gitlab-org/gitlab-ce!26923
Diffstat (limited to 'spec/support/shared_examples')
-rw-r--r-- | spec/support/shared_examples/quick_actions/merge_request/wip_quick_action_shared_examples.rb | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/spec/support/shared_examples/quick_actions/merge_request/wip_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/merge_request/wip_quick_action_shared_examples.rb index 6abb12b41b2..60d6e53e74f 100644 --- a/spec/support/shared_examples/quick_actions/merge_request/wip_quick_action_shared_examples.rb +++ b/spec/support/shared_examples/quick_actions/merge_request/wip_quick_action_shared_examples.rb @@ -1,4 +1,47 @@ # frozen_string_literal: true shared_examples 'wip quick action' do + context 'when the current user can toggle the WIP prefix' do + before do + sign_in(user) + visit project_merge_request_path(project, merge_request) + wait_for_requests + end + + it 'adds the WIP: prefix to the title' do + add_note('/wip') + + expect(page).not_to have_content '/wip' + expect(page).to have_content 'Commands applied' + + expect(merge_request.reload.work_in_progress?).to eq true + end + + it 'removes the WIP: prefix from the title' do + merge_request.update!(title: merge_request.wip_title) + add_note('/wip') + + expect(page).not_to have_content '/wip' + expect(page).to have_content 'Commands applied' + + expect(merge_request.reload.work_in_progress?).to eq false + end + end + + context 'when the current user cannot toggle the WIP prefix' do + before do + project.add_guest(guest) + sign_in(guest) + visit project_merge_request_path(project, merge_request) + end + + it 'does not change the WIP prefix' do + add_note('/wip') + + expect(page).not_to have_content '/wip' + expect(page).not_to have_content 'Commands applied' + + expect(merge_request.reload.work_in_progress?).to eq false + end + end end |