diff options
author | Felipe Artur <fcardozo@gitlab.com> | 2019-06-18 14:26:48 +0000 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-06-18 14:26:48 +0000 |
commit | 61bca6222ca8f605c49233508400f9b736ce9828 (patch) | |
tree | d1ffdd1fa4cfbaa01a8c5b25cdac3f5fe6aa3a17 /spec/support/shared_examples/quick_actions/issuable | |
parent | 53036a5bc6dcdc120ce828e3366be8b4486f9a6a (diff) | |
download | gitlab-ce-61bca6222ca8f605c49233508400f9b736ce9828.tar.gz |
Move some quick actions feature specs to unit tests
Move some feature specs for issues/merge requests quick actions
to unit tests. They are taking too long to run on the pipelines.
Diffstat (limited to 'spec/support/shared_examples/quick_actions/issuable')
24 files changed, 273 insertions, 1983 deletions
diff --git a/spec/support/shared_examples/quick_actions/issuable/assign_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/assign_quick_action_shared_examples.rb deleted file mode 100644 index d97da6be192..00000000000 --- a/spec/support/shared_examples/quick_actions/issuable/assign_quick_action_shared_examples.rb +++ /dev/null @@ -1,110 +0,0 @@ -# frozen_string_literal: true - -shared_examples 'assign quick action' do |issuable_type| - before do - project.add_maintainer(maintainer) - gitlab_sign_in(maintainer) - end - - context "new #{issuable_type}", :js do - before do - case issuable_type - when :merge_request - visit public_send('namespace_project_new_merge_request_path', project.namespace, project, new_url_opts) - wait_for_all_requests - when :issue - visit public_send('new_namespace_project_issue_path', project.namespace, project, new_url_opts) - wait_for_all_requests - end - end - - it "creates the #{issuable_type} and interprets assign quick action accordingly" do - assignee = create(:user, username: 'bob') - - fill_in "#{issuable_type}_title", with: 'bug 345' - fill_in "#{issuable_type}_description", with: "bug description\n/assign @bob" - click_button "Submit #{issuable_type}".humanize - - issuable = project.public_send(issuable_type.to_s.pluralize).first - - expect(issuable.description).to eq 'bug description' - expect(issuable.assignees).to eq [assignee] - expect(page).to have_content 'bug 345' - expect(page).to have_content 'bug description' - end - - it "creates the #{issuable_type} and interprets assign quick action accordingly" do - fill_in "#{issuable_type}_title", with: 'bug 345' - fill_in "#{issuable_type}_description", with: "bug description\n/assign me" - click_button "Submit #{issuable_type}".humanize - - issuable = project.public_send(issuable_type.to_s.pluralize).first - - expect(issuable.description).to eq 'bug description' - expect(issuable.assignees).to eq [maintainer] - expect(page).to have_content 'bug 345' - expect(page).to have_content 'bug description' - end - end - - context "post note to existing #{issuable_type}" do - before do - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it 'creates the note and interprets the assign quick action accordingly' do - assignee = create(:user, username: 'bob') - add_note("Awesome!\n\n/assign @bob") - - expect(page).to have_content 'Awesome!' - expect(page).not_to have_content '/assign @bob' - - wait_for_requests - issuable.reload - note = issuable.notes.user.first - - expect(note.note).to eq 'Awesome!' - expect(issuable.assignees).to eq [assignee] - end - - it "assigns the #{issuable_type} to the current user" do - add_note("/assign me") - - expect(page).not_to have_content '/assign me' - expect(page).to have_content 'Commands applied' - - expect(issuable.reload.assignees).to eq [maintainer] - end - end - - context "preview of note on #{issuable_type}", :js do - it 'explains assign quick action to bob' do - create(:user, username: 'bob') - - visit public_send("project_#{issuable_type}_path", project, issuable) - - page.within('.js-main-target-form') do - fill_in 'note[note]', with: "Awesome!\n/assign @bob " - click_on 'Preview' - - expect(page).not_to have_content '/assign @bob' - expect(page).to have_content 'Awesome!' - expect(page).to have_content 'Assigns @bob.' - end - end - - it 'explains assign quick action to me' do - visit public_send("project_#{issuable_type}_path", project, issuable) - - page.within('.js-main-target-form') do - fill_in 'note[note]', with: "Awesome!\n/assign me" - click_on 'Preview' - - expect(page).not_to have_content '/assign me' - expect(page).to have_content 'Awesome!' - expect(page).to have_content "Assigns @#{maintainer.username}." - end - end - end -end diff --git a/spec/support/shared_examples/quick_actions/issuable/award_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/award_quick_action_shared_examples.rb deleted file mode 100644 index 74cbfa3f4b4..00000000000 --- a/spec/support/shared_examples/quick_actions/issuable/award_quick_action_shared_examples.rb +++ /dev/null @@ -1,63 +0,0 @@ -# frozen_string_literal: true - -shared_examples 'award quick action' do |issuable_type| - before do - project.add_maintainer(maintainer) - gitlab_sign_in(maintainer) - end - - context "new #{issuable_type}", :js do - before do - case issuable_type - when :merge_request - visit public_send('namespace_project_new_merge_request_path', project.namespace, project, new_url_opts) - wait_for_all_requests - when :issue - visit public_send('new_namespace_project_issue_path', project.namespace, project, new_url_opts) - wait_for_all_requests - end - end - - it "creates the #{issuable_type} and interprets award quick action accordingly" do - fill_in "#{issuable_type}_title", with: 'bug 345' - fill_in "#{issuable_type}_description", with: "bug description\n/award :100:" - click_button "Submit #{issuable_type}".humanize - - issuable = project.public_send(issuable_type.to_s.pluralize).first - - expect(issuable.description).to eq 'bug description' - expect(issuable).to be_opened - expect(page).to have_content 'bug 345' - expect(page).to have_content 'bug description' - expect(issuable.award_emoji).to eq [] - end - end - - context "post note to existing #{issuable_type}" do - before do - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - expect(issuable.award_emoji).to eq [] - end - - it 'creates the note and interprets the award quick action accordingly' do - add_note("/award :100:") - - wait_for_requests - expect(page).not_to have_content '/award' - expect(page).to have_content 'Commands applied' - expect(issuable.reload.award_emoji.last.name).to eq('100') - end - end - - context "preview of note on #{issuable_type}", :js do - it 'explains label quick action' do - visit public_send("project_#{issuable_type}_path", project, issuable) - - preview_note('/award :100:') - - expect(page).not_to have_content '/award' - expect(page).to have_selector "gl-emoji[data-name='100']" - end - end -end diff --git a/spec/support/shared_examples/quick_actions/issuable/copy_metadata_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/copy_metadata_quick_action_shared_examples.rb deleted file mode 100644 index 1e1e3c7bc95..00000000000 --- a/spec/support/shared_examples/quick_actions/issuable/copy_metadata_quick_action_shared_examples.rb +++ /dev/null @@ -1,88 +0,0 @@ -# frozen_string_literal: true - -shared_examples 'copy_metadata quick action' do |issuable_type| - before do - project.add_maintainer(maintainer) - gitlab_sign_in(maintainer) - end - - context "new #{issuable_type}", :js do - before do - case issuable_type - when :merge_request - visit public_send('namespace_project_new_merge_request_path', project.namespace, project, new_url_opts) - wait_for_all_requests - when :issue - visit public_send('new_namespace_project_issue_path', project.namespace, project, new_url_opts) - wait_for_all_requests - end - end - - it "creates the #{issuable_type} and interprets copy_metadata quick action accordingly" do - fill_in "#{issuable_type}_title", with: 'bug 345' - fill_in "#{issuable_type}_description", with: "bug description\n/copy_metadata #{source_issuable.to_reference(project)}" - click_button "Submit #{issuable_type}".humanize - - issuable = project.public_send(issuable_type.to_s.pluralize).last - - expect(page).to have_content 'bug 345' - expect(page).to have_content 'bug description' - issuable.reload - expect(issuable.description).to eq 'bug description' - expect(issuable.milestone).to eq milestone - expect(issuable.labels).to match_array([label_bug, label_feature]) - end - end - - context "post note to existing #{issuable_type}" do - before do - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it 'creates the note and interprets copy_metadata quick action accordingly' do - add_note("/copy_metadata #{source_issuable.to_reference(project)}") - - wait_for_requests - expect(page).not_to have_content '/copy_metadata' - expect(page).to have_content 'Commands applied' - issuable.reload - expect(issuable.milestone).to eq milestone - expect(issuable.labels).to match_array([label_bug, label_feature]) - end - - context "when current user cannot copy_metadata" do - before do - guest = create(:user) - project.add_guest(guest) - - gitlab_sign_out - gitlab_sign_in(guest) - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it 'does not copy_metadata' do - add_note("/copy_metadata #{source_issuable.to_reference(project)}") - - wait_for_requests - expect(page).not_to have_content '/copy_metadata' - expect(page).not_to have_content 'Commands applied' - issuable.reload - expect(issuable.milestone).not_to eq milestone - expect(issuable.labels).to eq [] - end - end - end - - context "preview of note on #{issuable_type}", :js do - it 'explains copy_metadata quick action' do - visit public_send("project_#{issuable_type}_path", project, issuable) - - preview_note("/copy_metadata #{source_issuable.to_reference(project)}") - - expect(page).not_to have_content '/copy_metadata' - expect(page).to have_content "Copy labels and milestone from #{source_issuable.to_reference(project)}." - end - end -end diff --git a/spec/support/shared_examples/quick_actions/issuable/done_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/done_quick_action_shared_examples.rb deleted file mode 100644 index 8a72bbc13bf..00000000000 --- a/spec/support/shared_examples/quick_actions/issuable/done_quick_action_shared_examples.rb +++ /dev/null @@ -1,103 +0,0 @@ -# frozen_string_literal: true - -shared_examples 'done quick action' do |issuable_type| - before do - project.add_maintainer(maintainer) - gitlab_sign_in(maintainer) - end - - context "new #{issuable_type}", :js do - before do - case issuable_type - when :merge_request - visit public_send('namespace_project_new_merge_request_path', project.namespace, project, new_url_opts) - wait_for_all_requests - when :issue - visit public_send('new_namespace_project_issue_path', project.namespace, project, new_url_opts) - wait_for_all_requests - end - end - - it "creates the #{issuable_type} and interprets done quick action accordingly" do - fill_in "#{issuable_type}_title", with: 'bug 345' - fill_in "#{issuable_type}_description", with: "bug description\n/done" - click_button "Submit #{issuable_type}".humanize - - issuable = project.public_send(issuable_type.to_s.pluralize).first - - expect(issuable.description).to eq 'bug description' - expect(issuable).to be_opened - expect(page).to have_content 'bug 345' - expect(page).to have_content 'bug description' - - todos = TodosFinder.new(maintainer).execute - expect(todos.size).to eq 0 - end - end - - context "post note to existing #{issuable_type}" do - before do - TodoService.new.mark_todo(issuable, maintainer) - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it 'creates the note and interprets the done quick action accordingly' do - todos = TodosFinder.new(maintainer).execute - todo = todos.first - expect(todo.reload).to be_pending - - expect(todos.size).to eq 1 - expect(todo.target).to eq issuable - expect(todo.author).to eq maintainer - expect(todo.user).to eq maintainer - - add_note('/done') - - wait_for_requests - expect(page).not_to have_content '/done' - expect(page).to have_content 'Commands applied' - expect(todo.reload).to be_done - end - - context "when current user cannot mark #{issuable_type} todo as done" do - before do - guest = create(:user) - project.add_guest(guest) - - gitlab_sign_out - gitlab_sign_in(guest) - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it "does not set the #{issuable_type} todo as done" do - todos = TodosFinder.new(maintainer).execute - todo = todos.first - expect(todo.reload).to be_pending - - expect(todos.size).to eq 1 - expect(todo.target).to eq issuable - expect(todo.author).to eq maintainer - expect(todo.user).to eq maintainer - - add_note('/done') - - expect(page).not_to have_content 'Commands applied' - expect(todo.reload).to be_pending - end - end - end - - context "preview of note on #{issuable_type}", :js do - it 'explains done quick action' do - TodoService.new.mark_todo(issuable, maintainer) - visit public_send("project_#{issuable_type}_path", project, issuable) - - preview_note('/done') - - expect(page).not_to have_content '/done' - expect(page).to have_content "Marks todo as done." - end - end -end diff --git a/spec/support/shared_examples/quick_actions/issuable/estimate_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/estimate_quick_action_shared_examples.rb deleted file mode 100644 index 648755d7e55..00000000000 --- a/spec/support/shared_examples/quick_actions/issuable/estimate_quick_action_shared_examples.rb +++ /dev/null @@ -1,81 +0,0 @@ -# frozen_string_literal: true - -shared_examples 'estimate quick action' do |issuable_type| - before do - project.add_maintainer(maintainer) - gitlab_sign_in(maintainer) - end - - context "new #{issuable_type}", :js do - before do - case issuable_type - when :merge_request - visit public_send('namespace_project_new_merge_request_path', project.namespace, project, new_url_opts) - wait_for_all_requests - when :issue - visit public_send('new_namespace_project_issue_path', project.namespace, project, new_url_opts) - wait_for_all_requests - end - end - - it "creates the #{issuable_type} and interprets estimate quick action accordingly" do - fill_in "#{issuable_type}_title", with: 'bug 345' - fill_in "#{issuable_type}_description", with: "bug description\n/estimate 1d 2h 3m" - click_button "Submit #{issuable_type}".humanize - - issuable = project.public_send(issuable_type.to_s.pluralize).first - - expect(issuable.description).to eq 'bug description' - expect(page).to have_content 'bug 345' - expect(page).to have_content 'bug description' - expect(issuable.time_estimate).to eq 36180 - end - end - - context "post note to existing #{issuable_type}" do - before do - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it 'creates the note and interprets the estimate quick action accordingly' do - add_note("/estimate 1d 2h 3m") - - wait_for_requests - expect(page).not_to have_content '/estimate' - expect(page).to have_content 'Commands applied' - expect(issuable.reload.time_estimate).to eq 36180 - end - - context "when current user cannot set estimate to #{issuable_type}" do - before do - guest = create(:user) - project.add_guest(guest) - - gitlab_sign_out - gitlab_sign_in(guest) - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it 'does not set estimate' do - add_note("/estimate ~bug ~feature") - - wait_for_requests - expect(page).not_to have_content '/estimate' - expect(issuable.reload.time_estimate).to eq 0 - end - end - end - - context "preview of note on #{issuable_type}", :js do - it 'explains estimate quick action' do - visit public_send("project_#{issuable_type}_path", project, issuable) - - preview_note('/estimate 1d 2h 3m') - - expect(page).not_to have_content '/estimate' - expect(page).to have_content 'Sets time estimate to 1d 2h 3m.' - end - end -end diff --git a/spec/support/shared_examples/quick_actions/issuable/issuable_quick_actions_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/issuable_quick_actions_shared_examples.rb new file mode 100644 index 00000000000..439c068471b --- /dev/null +++ b/spec/support/shared_examples/quick_actions/issuable/issuable_quick_actions_shared_examples.rb @@ -0,0 +1,273 @@ +# frozen_string_literal: true + +shared_examples 'issuable quick actions' do + QuickAction = Struct.new(:action_text, :expectation, :before_action, keyword_init: true) do + # Pass a block as :before_action if + # issuable state needs to be changed before + # the quick action is executed. + def call_before_action + before_action.call if before_action + end + + def skip_access_check + action_text["/todo"] || + action_text["/done"] || + action_text["/subscribe"] || + action_text["/shrug"] || + action_text["/tableflip"] + end + end + + # Quick actions shared by issues and merge requests + let(:issuable_quick_actions) do + [ + QuickAction.new( + action_text: "/subscribe", + expectation: ->(noteable, can_use_quick_action) { + if can_use_quick_action + expect(noteable).to be_subscribed(note_author, issuable.project) + else + expect(noteable).not_to be_subscribed(note_author, issuable.project) + end + } + ), + QuickAction.new( + action_text: "/unsubscribe", + expectation: ->(noteable, can_use_quick_action) { + expect(noteable).not_to be_subscribed(note_author, issuable.project) + } + ), + QuickAction.new( + action_text: "/todo", + expectation: ->(noteable, can_use_quick_action) { + expect(noteable.todos.count == 1).to eq(can_use_quick_action) + } + ), + QuickAction.new( + action_text: "/done", + expectation: ->(noteable, can_use_quick_action) { + expect(noteable.todos.last.done?).to eq(can_use_quick_action) + } + ), + QuickAction.new( + action_text: "/close", + expectation: ->(noteable, can_use_quick_action) { + expect(noteable.closed?).to eq(can_use_quick_action) + } + ), + QuickAction.new( + action_text: "/reopen", + before_action: -> { + issuable.close + }, + expectation: ->(noteable, can_use_quick_action) { + expect(noteable.open?).to eq(can_use_quick_action) + } + ), + QuickAction.new( + action_text: "/assign @#{user.username}", + expectation: ->(noteable, can_use_quick_action) { + if noteable.allows_multiple_assignees? + expect(noteable.assignees == [old_assignee, user]).to eq(can_use_quick_action) + else + expect(noteable.assignees == [user]).to eq(can_use_quick_action) + end + } + ), + QuickAction.new( + action_text: "/unassign", + expectation: ->(noteable, can_use_quick_action) { + if can_use_quick_action + expect(noteable.assignees).to be_empty + else + expect(noteable.assignees).not_to be_empty + end + } + ), + QuickAction.new( + action_text: "/title new title", + expectation: ->(noteable, can_use_quick_action) { + expect(noteable.title == "new title").to eq(can_use_quick_action) + } + ), + QuickAction.new( + action_text: "/lock", + expectation: ->(noteable, can_use_quick_action) { + expect(noteable.discussion_locked?).to eq(can_use_quick_action) + } + ), + QuickAction.new( + action_text: "/unlock", + before_action: -> { + issuable.update(discussion_locked: true) + }, + expectation: ->(noteable, can_use_quick_action) { + if can_use_quick_action + expect(noteable).not_to be_discussion_locked + else + expect(noteable).to be_discussion_locked + end + } + ), + QuickAction.new( + action_text: "/milestone %\"sprint\"", + expectation: ->(noteable, can_use_quick_action) { + expect(noteable.milestone == milestone).to eq(can_use_quick_action) + } + ), + QuickAction.new( + action_text: "/remove_milestone", + before_action: -> { + issuable.update(milestone_id: milestone.id) + }, + expectation: ->(noteable, can_use_quick_action) { + if can_use_quick_action + expect(noteable.milestone_id).to be_nil + else + expect(noteable.milestone_id).to eq(milestone.id) + end + } + ), + QuickAction.new( + action_text: "/label ~feature", + expectation: ->(noteable, can_use_quick_action) { + expect(noteable.labels&.last&.id == feature_label.id).to eq(can_use_quick_action) + } + ), + QuickAction.new( + action_text: "/unlabel", + expectation: ->(noteable, can_use_quick_action) { + if can_use_quick_action + expect(noteable.labels).to be_empty + else + expect(noteable.labels).not_to be_empty + end + } + ), + QuickAction.new( + action_text: "/award :100:", + expectation: ->(noteable, can_use_quick_action) { + if can_use_quick_action + expect(noteable.award_emoji.last.name).to eq("100") + else + expect(noteable.award_emoji).to be_empty + end + } + ), + QuickAction.new( + action_text: "/estimate 1d 2h 3m", + expectation: ->(noteable, can_use_quick_action) { + expect(noteable.time_estimate == 36180).to eq(can_use_quick_action) + } + ), + QuickAction.new( + action_text: "/remove_estimate", + before_action: -> { + issuable.update(time_estimate: 30000) + }, + expectation: ->(noteable, can_use_quick_action) { + if can_use_quick_action + expect(noteable.time_estimate).to be_zero + else + expect(noteable.time_estimate).to eq(30000) + end + } + ), + QuickAction.new( + action_text: "/spend 1d 2h 3m", + expectation: ->(noteable, can_use_quick_action) { + expect(noteable.total_time_spent == 36180).to eq(can_use_quick_action) + } + ), + QuickAction.new( + action_text: "/remove_time_spent", + expectation: ->(noteable, can_use_quick_action) { + if can_use_quick_action + expect(noteable.total_time_spent == 0) + else + expect(noteable.timelogs).to be_empty + end + } + ), + QuickAction.new( + action_text: "/shrug oops", + expectation: ->(noteable, can_use_quick_action) { + expect(noteable.notes&.last&.note == "HELLO\noops ¯\\_(ツ)_/¯\nWORLD").to eq(can_use_quick_action) + } + ), + QuickAction.new( + action_text: "/tableflip oops", + expectation: ->(noteable, can_use_quick_action) { + expect(noteable.notes&.last&.note == "HELLO\noops (╯°□°)╯︵ ┻━┻\nWORLD").to eq(can_use_quick_action) + } + ), + QuickAction.new( + action_text: "/copy_metadata #{issue_2.to_reference}", + expectation: ->(noteable, can_use_quick_action) { + if can_use_quick_action + expect(noteable.labels).to eq(issue_2.labels) + expect(noteable.milestone).to eq(issue_2.milestone) + else + expect(noteable.labels).not_to eq(issue_2.labels) + expect(noteable.milestone).not_to eq(issue_2.milestone) + end + } + ) + ] + end + + let(:old_assignee) { create(:user) } + + before do + project.add_developer(old_assignee) + issuable.update(assignees: [old_assignee]) + end + + context 'when user can update issuable' do + set(:developer) { create(:user) } + let(:note_author) { developer } + + before do + project.add_developer(developer) + end + + it 'saves the note and updates the issue' do + quick_actions.each do |quick_action| + note_text = %(HELLO\n#{quick_action.action_text}\nWORLD) + quick_action.call_before_action + + note = described_class.new(project, developer, note_params.merge(note: note_text)).execute + noteable = note.noteable + + # shrug and tablefip quick actions modifies the note text + # on these cases we need to skip this assertion + if !quick_action.action_text["shrug"] && !quick_action.action_text["tableflip"] + expect(note.note).to eq "HELLO\nWORLD" + end + + quick_action.expectation.call(noteable, true) + end + end + end + + context 'when user cannot update issuable' do + set(:non_member) { create(:user) } + let(:note_author) { non_member } + + it 'applies commands that user can execute' do + quick_actions.each do |quick_action| + note_text = %(HELLO\n#{quick_action.action_text}\nWORLD) + quick_action.call_before_action + + note = described_class.new(project, non_member, note_params.merge(note: note_text)).execute + noteable = note.noteable + + if quick_action.skip_access_check + quick_action.expectation.call(noteable, true) + else + quick_action.expectation.call(noteable, false) + end + end + end + end +end diff --git a/spec/support/shared_examples/quick_actions/issuable/label_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/label_quick_action_shared_examples.rb deleted file mode 100644 index 9066e382b70..00000000000 --- a/spec/support/shared_examples/quick_actions/issuable/label_quick_action_shared_examples.rb +++ /dev/null @@ -1,83 +0,0 @@ -# frozen_string_literal: true - -shared_examples 'label quick action' do |issuable_type| - before do - project.add_maintainer(maintainer) - gitlab_sign_in(maintainer) - end - - context "new #{issuable_type}", :js do - before do - case issuable_type - when :merge_request - visit public_send('namespace_project_new_merge_request_path', project.namespace, project, new_url_opts) - wait_for_all_requests - when :issue - visit public_send('new_namespace_project_issue_path', project.namespace, project, new_url_opts) - wait_for_all_requests - end - end - - it "creates the #{issuable_type} and interprets label quick action accordingly" do - fill_in "#{issuable_type}_title", with: 'bug 345' - fill_in "#{issuable_type}_description", with: "bug description\n/label ~bug ~feature" - click_button "Submit #{issuable_type}".humanize - - issuable = project.public_send(issuable_type.to_s.pluralize).first - - expect(issuable.description).to eq 'bug description' - expect(issuable).to be_opened - expect(page).to have_content 'bug 345' - expect(page).to have_content 'bug description' - expect(issuable.labels).to match_array([label_bug, label_feature]) - end - end - - context "post note to existing #{issuable_type}" do - before do - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - expect(issuable.labels).to eq [] - end - - it 'creates the note and interprets the label quick action accordingly' do - add_note("/label ~bug ~feature") - - wait_for_requests - expect(page).not_to have_content '/label' - expect(page).to have_content 'Commands applied' - expect(issuable.reload.labels).to match_array([label_bug, label_feature]) - end - - context "when current user cannot set label to #{issuable_type}" do - before do - guest = create(:user) - project.add_guest(guest) - - gitlab_sign_out - gitlab_sign_in(guest) - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it 'does not set label' do - add_note("/label ~bug ~feature") - - wait_for_requests - expect(page).not_to have_content '/label' - expect(issuable.labels).to eq [] - end - end - end - - context "preview of note on #{issuable_type}", :js do - it 'explains label quick action' do - visit public_send("project_#{issuable_type}_path", project, issuable) - - preview_note('/label ~bug ~feature') - - expect(page).not_to have_content '/label' - expect(page).to have_content 'Adds bug feature labels.' - end - end -end diff --git a/spec/support/shared_examples/quick_actions/issuable/lock_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/lock_quick_action_shared_examples.rb deleted file mode 100644 index d3197f2a459..00000000000 --- a/spec/support/shared_examples/quick_actions/issuable/lock_quick_action_shared_examples.rb +++ /dev/null @@ -1,84 +0,0 @@ -# frozen_string_literal: true - -shared_examples 'lock quick action' do |issuable_type| - before do - project.add_maintainer(maintainer) - gitlab_sign_in(maintainer) - end - - context "new #{issuable_type}", :js do - before do - case issuable_type - when :merge_request - visit public_send('namespace_project_new_merge_request_path', project.namespace, project, new_url_opts) - wait_for_all_requests - when :issue - visit public_send('new_namespace_project_issue_path', project.namespace, project, new_url_opts) - wait_for_all_requests - end - end - - it "creates the #{issuable_type} and interprets lock quick action accordingly" do - fill_in "#{issuable_type}_title", with: 'bug 345' - fill_in "#{issuable_type}_description", with: "bug description\n/lock" - click_button "Submit #{issuable_type}".humanize - - issuable = project.public_send(issuable_type.to_s.pluralize).first - - expect(issuable.description).to eq 'bug description' - expect(issuable).to be_opened - expect(page).to have_content 'bug 345' - expect(page).to have_content 'bug description' - expect(issuable).not_to be_discussion_locked - end - end - - context "post note to existing #{issuable_type}" do - before do - issuable.update(discussion_locked: false) - expect(issuable).not_to be_discussion_locked - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it 'creates the note and interprets the lock quick action accordingly' do - add_note('/lock') - - wait_for_requests - expect(page).not_to have_content '/lock' - expect(page).to have_content 'Commands applied' - expect(issuable.reload).to be_discussion_locked - end - - context "when current user cannot lock to #{issuable_type}" do - before do - guest = create(:user) - project.add_guest(guest) - - gitlab_sign_out - gitlab_sign_in(guest) - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it "does not lock the #{issuable_type}" do - add_note('/lock') - - wait_for_requests - expect(page).not_to have_content '/lock' - expect(issuable).not_to be_discussion_locked - end - end - end - - context "preview of note on #{issuable_type}", :js do - it 'explains lock quick action' do - visit public_send("project_#{issuable_type}_path", project, issuable) - - preview_note('/lock') - - expect(page).not_to have_content '/lock' - expect(page).to have_content "Locks the discussion" - end - end -end diff --git a/spec/support/shared_examples/quick_actions/issuable/milestone_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/milestone_quick_action_shared_examples.rb deleted file mode 100644 index 7f16ce93b6a..00000000000 --- a/spec/support/shared_examples/quick_actions/issuable/milestone_quick_action_shared_examples.rb +++ /dev/null @@ -1,83 +0,0 @@ -# frozen_string_literal: true - -shared_examples 'milestone quick action' do |issuable_type| - before do - project.add_maintainer(maintainer) - gitlab_sign_in(maintainer) - end - - context "new #{issuable_type}", :js do - before do - case issuable_type - when :merge_request - visit public_send('namespace_project_new_merge_request_path', project.namespace, project, new_url_opts) - wait_for_all_requests - when :issue - visit public_send('new_namespace_project_issue_path', project.namespace, project, new_url_opts) - wait_for_all_requests - end - end - - it "creates the #{issuable_type} and interprets milestone quick action accordingly" do - fill_in "#{issuable_type}_title", with: 'bug 345' - fill_in "#{issuable_type}_description", with: "bug description\n/milestone %\"ASAP\"" - click_button "Submit #{issuable_type}".humanize - - issuable = project.public_send(issuable_type.to_s.pluralize).first - - expect(issuable.description).to eq 'bug description' - expect(issuable).to be_opened - expect(page).to have_content 'bug 345' - expect(page).to have_content 'bug description' - expect(issuable.milestone).to eq milestone - end - end - - context "post note to existing #{issuable_type}" do - before do - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - expect(issuable.milestone).to be_nil - end - - it 'creates the note and interprets the milestone quick action accordingly' do - add_note("/milestone %\"ASAP\"") - - wait_for_requests - expect(page).not_to have_content '/milestone' - expect(page).to have_content 'Commands applied' - expect(issuable.reload.milestone).to eq milestone - end - - context "when current user cannot set milestone to #{issuable_type}" do - before do - guest = create(:user) - project.add_guest(guest) - - gitlab_sign_out - gitlab_sign_in(guest) - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it 'does not set milestone' do - add_note('/milestone') - - wait_for_requests - expect(page).not_to have_content '/milestone' - expect(issuable.reload.milestone).to be_nil - end - end - end - - context "preview of note on #{issuable_type}", :js do - it 'explains milestone quick action' do - visit public_send("project_#{issuable_type}_path", project, issuable) - - preview_note("/milestone %\"ASAP\"") - - expect(page).not_to have_content '/milestone' - expect(page).to have_content 'Sets the milestone to %ASAP' - end - end -end diff --git a/spec/support/shared_examples/quick_actions/issuable/relabel_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/relabel_quick_action_shared_examples.rb deleted file mode 100644 index 643ae77516a..00000000000 --- a/spec/support/shared_examples/quick_actions/issuable/relabel_quick_action_shared_examples.rb +++ /dev/null @@ -1,95 +0,0 @@ -# frozen_string_literal: true - -shared_examples 'relabel quick action' do |issuable_type| - before do - project.add_maintainer(maintainer) - gitlab_sign_in(maintainer) - end - - context "new #{issuable_type}", :js do - before do - case issuable_type - when :merge_request - visit public_send('namespace_project_new_merge_request_path', project.namespace, project, new_url_opts) - wait_for_all_requests - when :issue - visit public_send('new_namespace_project_issue_path', project.namespace, project, new_url_opts) - wait_for_all_requests - end - end - - it "creates the #{issuable_type} and interprets relabel quick action accordingly" do - fill_in "#{issuable_type}_title", with: 'bug 345' - fill_in "#{issuable_type}_description", with: "bug description\n/label ~bug /relabel ~feature" - click_button "Submit #{issuable_type}".humanize - - issuable = project.public_send(issuable_type.to_s.pluralize).first - - expect(issuable.description).to eq 'bug description' - expect(issuable).to be_opened - expect(page).to have_content 'bug 345' - expect(page).to have_content 'bug description' - expect(issuable.labels).to eq [label_bug, label_feature] - end - end - - context "post note to existing #{issuable_type}" do - before do - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - issuable.update(labels: [label_bug]) - end - - it 'creates the note and interprets the relabel quick action accordingly' do - add_note('/relabel ~feature') - - wait_for_requests - expect(page).not_to have_content '/relabel' - expect(page).to have_content 'Commands applied' - expect(issuable.reload.labels).to match_array([label_feature]) - end - - it 'creates the note and interprets the relabel quick action with empty param' do - add_note('/relabel') - - wait_for_requests - expect(page).not_to have_content '/relabel' - expect(page).to have_content 'Commands applied' - expect(issuable.reload.labels).to match_array([label_bug]) - end - - context "when current user cannot relabel to #{issuable_type}" do - before do - guest = create(:user) - project.add_guest(guest) - - gitlab_sign_out - gitlab_sign_in(guest) - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it 'does not relabel' do - add_note('/relabel ~feature') - - wait_for_requests - expect(page).not_to have_content '/relabel' - expect(issuable.labels).to match_array([label_bug]) - end - end - end - - context "preview of note on #{issuable_type}", :js do - before do - issuable.update(labels: [label_bug]) - visit public_send("project_#{issuable_type}_path", project, issuable) - end - - it 'explains relabel all quick action' do - preview_note('/relabel ~feature') - - expect(page).not_to have_content '/relabel' - expect(page).to have_content 'Replaces all labels with feature label.' - end - end -end diff --git a/spec/support/shared_examples/quick_actions/issuable/remove_estimate_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/remove_estimate_quick_action_shared_examples.rb deleted file mode 100644 index 24f6f8d5bf4..00000000000 --- a/spec/support/shared_examples/quick_actions/issuable/remove_estimate_quick_action_shared_examples.rb +++ /dev/null @@ -1,82 +0,0 @@ -# frozen_string_literal: true - -shared_examples 'remove_estimate quick action' do |issuable_type| - before do - project.add_maintainer(maintainer) - gitlab_sign_in(maintainer) - end - - context "new #{issuable_type}", :js do - before do - case issuable_type - when :merge_request - visit public_send('namespace_project_new_merge_request_path', project.namespace, project, new_url_opts) - wait_for_all_requests - when :issue - visit public_send('new_namespace_project_issue_path', project.namespace, project, new_url_opts) - wait_for_all_requests - end - end - - it "creates the #{issuable_type} and interprets estimate quick action accordingly" do - fill_in "#{issuable_type}_title", with: 'bug 345' - fill_in "#{issuable_type}_description", with: "bug description\n/remove_estimate" - click_button "Submit #{issuable_type}".humanize - - issuable = project.public_send(issuable_type.to_s.pluralize).first - - expect(issuable.description).to eq 'bug description' - expect(page).to have_content 'bug 345' - expect(page).to have_content 'bug description' - expect(issuable.time_estimate).to eq 0 - end - end - - context "post note to existing #{issuable_type}" do - before do - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - issuable.update_attribute(:time_estimate, 36180) - end - - it 'creates the note and interprets the remove_estimate quick action accordingly' do - add_note("/remove_estimate") - - wait_for_requests - expect(page).not_to have_content '/remove_estimate' - expect(page).to have_content 'Commands applied' - expect(issuable.reload.time_estimate).to eq 0 - end - - context "when current user cannot remove_estimate" do - before do - guest = create(:user) - project.add_guest(guest) - - gitlab_sign_out - gitlab_sign_in(guest) - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it 'does not remove_estimate' do - add_note('/remove_estimate') - - wait_for_requests - expect(page).not_to have_content '/remove_estimate' - expect(issuable.reload.time_estimate).to eq 36180 - end - end - end - - context "preview of note on #{issuable_type}", :js do - it 'explains remove_estimate quick action' do - visit public_send("project_#{issuable_type}_path", project, issuable) - - preview_note('/remove_estimate') - - expect(page).not_to have_content '/remove_estimate' - expect(page).to have_content 'Removes time estimate.' - end - end -end diff --git a/spec/support/shared_examples/quick_actions/issuable/remove_milestone_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/remove_milestone_quick_action_shared_examples.rb deleted file mode 100644 index edd92d5cdbc..00000000000 --- a/spec/support/shared_examples/quick_actions/issuable/remove_milestone_quick_action_shared_examples.rb +++ /dev/null @@ -1,86 +0,0 @@ -# frozen_string_literal: true - -shared_examples 'remove_milestone quick action' do |issuable_type| - before do - project.add_maintainer(maintainer) - gitlab_sign_in(maintainer) - end - - context "new #{issuable_type}", :js do - before do - case issuable_type - when :merge_request - visit public_send('namespace_project_new_merge_request_path', project.namespace, project, new_url_opts) - wait_for_all_requests - when :issue - visit public_send('new_namespace_project_issue_path', project.namespace, project, new_url_opts) - wait_for_all_requests - end - end - - it "creates the #{issuable_type} and interprets remove_milestone quick action accordingly" do - fill_in "#{issuable_type}_title", with: 'bug 345' - fill_in "#{issuable_type}_description", with: "bug description\n/remove_milestone" - click_button "Submit #{issuable_type}".humanize - - issuable = project.public_send(issuable_type.to_s.pluralize).first - - expect(issuable.description).to eq 'bug description' - expect(issuable).to be_opened - expect(page).to have_content 'bug 345' - expect(page).to have_content 'bug description' - expect(issuable.milestone).to be_nil - end - end - - context "post note to existing #{issuable_type}" do - before do - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - issuable.update(milestone: milestone) - expect(issuable.milestone).to eq(milestone) - end - - it 'creates the note and interprets the remove_milestone quick action accordingly' do - add_note("/remove_milestone") - - wait_for_requests - expect(page).not_to have_content '/remove_milestone' - expect(page).to have_content 'Commands applied' - expect(issuable.reload.milestone).to be_nil - end - - context "when current user cannot remove milestone to #{issuable_type}" do - before do - guest = create(:user) - project.add_guest(guest) - - gitlab_sign_out - gitlab_sign_in(guest) - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it 'does not remove milestone' do - add_note('/remove_milestone') - - wait_for_requests - expect(page).not_to have_content '/remove_milestone' - expect(issuable.reload.milestone).to eq(milestone) - end - end - end - - context "preview of note on #{issuable_type}", :js do - it 'explains remove_milestone quick action' do - issuable.update(milestone: milestone) - expect(issuable.milestone).to eq(milestone) - visit public_send("project_#{issuable_type}_path", project, issuable) - - preview_note("/remove_milestone") - - expect(page).not_to have_content '/remove_milestone' - expect(page).to have_content 'Removes %ASAP milestone.' - end - end -end diff --git a/spec/support/shared_examples/quick_actions/issuable/remove_time_spent_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/remove_time_spent_quick_action_shared_examples.rb deleted file mode 100644 index 6d5894b2318..00000000000 --- a/spec/support/shared_examples/quick_actions/issuable/remove_time_spent_quick_action_shared_examples.rb +++ /dev/null @@ -1,82 +0,0 @@ -# frozen_string_literal: true - -shared_examples 'remove_time_spent quick action' do |issuable_type| - before do - project.add_maintainer(maintainer) - gitlab_sign_in(maintainer) - end - - context "new #{issuable_type}", :js do - before do - case issuable_type - when :merge_request - visit public_send('namespace_project_new_merge_request_path', project.namespace, project, new_url_opts) - wait_for_all_requests - when :issue - visit public_send('new_namespace_project_issue_path', project.namespace, project, new_url_opts) - wait_for_all_requests - end - end - - it "creates the #{issuable_type} and interprets remove_time_spent quick action accordingly" do - fill_in "#{issuable_type}_title", with: 'bug 345' - fill_in "#{issuable_type}_description", with: "bug description\n/remove_time_spent" - click_button "Submit #{issuable_type}".humanize - - issuable = project.public_send(issuable_type.to_s.pluralize).first - - expect(issuable.description).to eq 'bug description' - expect(page).to have_content 'bug 345' - expect(page).to have_content 'bug description' - expect(issuable.total_time_spent).to eq 0 - end - end - - context "post note to existing #{issuable_type}" do - before do - issuable.update!(spend_time: { duration: 36180, user_id: maintainer.id }) - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it 'creates the note and interprets the remove_time_spent quick action accordingly' do - add_note("/remove_time_spent") - - wait_for_requests - expect(page).not_to have_content '/remove_time_spent' - expect(page).to have_content 'Commands applied' - expect(issuable.reload.total_time_spent).to eq 0 - end - - context "when current user cannot set remove_time_spent time" do - before do - guest = create(:user) - project.add_guest(guest) - - gitlab_sign_out - gitlab_sign_in(guest) - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it 'does not set remove_time_spent time' do - add_note("/remove_time_spent") - - wait_for_requests - expect(page).not_to have_content '/remove_time_spent' - expect(issuable.reload.total_time_spent).to eq 36180 - end - end - end - - context "preview of note on #{issuable_type}", :js do - it 'explains remove_time_spent quick action' do - visit public_send("project_#{issuable_type}_path", project, issuable) - - preview_note('/remove_time_spent') - - expect(page).not_to have_content '/remove_time_spent' - expect(page).to have_content 'Removes spent time.' - end - end -end diff --git a/spec/support/shared_examples/quick_actions/issuable/reopen_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/reopen_quick_action_shared_examples.rb deleted file mode 100644 index af173e93bb5..00000000000 --- a/spec/support/shared_examples/quick_actions/issuable/reopen_quick_action_shared_examples.rb +++ /dev/null @@ -1,86 +0,0 @@ -# frozen_string_literal: true - -shared_examples 'reopen quick action' do |issuable_type| - before do - project.add_maintainer(maintainer) - gitlab_sign_in(maintainer) - end - - context "new #{issuable_type}", :js do - before do - case issuable_type - when :merge_request - visit public_send('namespace_project_new_merge_request_path', project.namespace, project, new_url_opts) - wait_for_all_requests - when :issue - visit public_send('new_namespace_project_issue_path', project.namespace, project, new_url_opts) - wait_for_all_requests - end - end - - it "creates the #{issuable_type} and interprets reopen quick action accordingly" do - fill_in "#{issuable_type}_title", with: 'bug 345' - fill_in "#{issuable_type}_description", with: "bug description\n/reopen" - click_button "Submit #{issuable_type}".humanize - - issuable = project.public_send(issuable_type.to_s.pluralize).first - - expect(issuable.description).to eq 'bug description' - expect(issuable).to be_opened - expect(page).to have_content 'bug 345' - expect(page).to have_content 'bug description' - end - end - - context "post note to existing #{issuable_type}" do - before do - issuable.close - expect(issuable).to be_closed - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it 'creates the note and interprets the reopen quick action accordingly' do - add_note('/reopen') - - wait_for_requests - expect(page).not_to have_content '/reopen' - expect(page).to have_content 'Commands applied' - - issuable.reload - expect(issuable).to be_opened - end - - context "when current user cannot reopen #{issuable_type}" do - before do - guest = create(:user) - project.add_guest(guest) - - gitlab_sign_out - gitlab_sign_in(guest) - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it "does not reopen the #{issuable_type}" do - add_note('/reopen') - - expect(page).not_to have_content 'Commands applied' - expect(issuable).to be_closed - end - end - end - - context "preview of note on #{issuable_type}", :js do - it 'explains reopen quick action' do - issuable.close - expect(issuable).to be_closed - visit public_send("project_#{issuable_type}_path", project, issuable) - - preview_note('/reopen') - - expect(page).not_to have_content '/reopen' - expect(page).to have_content "Reopens this #{issuable_type.to_s.humanize.downcase}." - end - end -end diff --git a/spec/support/shared_examples/quick_actions/issuable/shrug_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/shrug_quick_action_shared_examples.rb deleted file mode 100644 index b592cf16f67..00000000000 --- a/spec/support/shared_examples/quick_actions/issuable/shrug_quick_action_shared_examples.rb +++ /dev/null @@ -1,60 +0,0 @@ -# frozen_string_literal: true - -shared_examples 'shrug quick action' do |issuable_type| - before do - project.add_maintainer(maintainer) - gitlab_sign_in(maintainer) - end - - context "new #{issuable_type}", :js do - before do - case issuable_type - when :merge_request - visit public_send('namespace_project_new_merge_request_path', project.namespace, project, new_url_opts) - wait_for_all_requests - when :issue - visit public_send('new_namespace_project_issue_path', project.namespace, project, new_url_opts) - wait_for_all_requests - end - end - - it "creates the #{issuable_type} and interprets shrug quick action accordingly" do - fill_in "#{issuable_type}_title", with: 'bug 345' - fill_in "#{issuable_type}_description", with: "bug description\n/shrug oops" - click_button "Submit #{issuable_type}".humanize - - issuable = project.public_send(issuable_type.to_s.pluralize).first - - expect(issuable.description).to eq "bug description\noops ¯\\_(ツ)_/¯" - expect(page).to have_content 'bug 345' - expect(page).to have_content "bug description oops ¯\\_(ツ)_/¯" - end - end - - context "post note to existing #{issuable_type}" do - before do - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it 'creates the note and interprets shrug quick action accordingly' do - add_note("/shrug oops") - - wait_for_requests - expect(page).not_to have_content '/shrug oops' - expect(page).to have_content "oops ¯\\_(ツ)_/¯" - expect(issuable.notes.last.note).to eq "oops ¯\\_(ツ)_/¯" - end - end - - context "preview of note on #{issuable_type}", :js do - it 'explains shrug quick action' do - visit public_send("project_#{issuable_type}_path", project, issuable) - - preview_note('/shrug oops') - - expect(page).not_to have_content '/shrug' - expect(page).to have_content "oops ¯\\_(ツ)_/¯" - end - end -end diff --git a/spec/support/shared_examples/quick_actions/issuable/spend_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/spend_quick_action_shared_examples.rb deleted file mode 100644 index 97b4885eba0..00000000000 --- a/spec/support/shared_examples/quick_actions/issuable/spend_quick_action_shared_examples.rb +++ /dev/null @@ -1,81 +0,0 @@ -# frozen_string_literal: true - -shared_examples 'spend quick action' do |issuable_type| - before do - project.add_maintainer(maintainer) - gitlab_sign_in(maintainer) - end - - context "new #{issuable_type}", :js do - before do - case issuable_type - when :merge_request - visit public_send('namespace_project_new_merge_request_path', project.namespace, project, new_url_opts) - wait_for_all_requests - when :issue - visit public_send('new_namespace_project_issue_path', project.namespace, project, new_url_opts) - wait_for_all_requests - end - end - - it "creates the #{issuable_type} and interprets spend quick action accordingly" do - fill_in "#{issuable_type}_title", with: 'bug 345' - fill_in "#{issuable_type}_description", with: "bug description\n/spend 1d 2h 3m" - click_button "Submit #{issuable_type}".humanize - - issuable = project.public_send(issuable_type.to_s.pluralize).first - - expect(issuable.description).to eq 'bug description' - expect(page).to have_content 'bug 345' - expect(page).to have_content 'bug description' - expect(issuable.total_time_spent).to eq 36180 - end - end - - context "post note to existing #{issuable_type}" do - before do - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it 'creates the note and interprets the spend quick action accordingly' do - add_note("/spend 1d 2h 3m") - - wait_for_requests - expect(page).not_to have_content '/spend' - expect(page).to have_content 'Commands applied' - expect(issuable.reload.total_time_spent).to eq 36180 - end - - context "when current user cannot set spend time" do - before do - guest = create(:user) - project.add_guest(guest) - - gitlab_sign_out - gitlab_sign_in(guest) - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it 'does not set spend time' do - add_note("/spend 1s 2h 3m") - - wait_for_requests - expect(page).not_to have_content '/spend' - expect(issuable.reload.total_time_spent).to eq 0 - end - end - end - - context "preview of note on #{issuable_type}", :js do - it 'explains spend quick action' do - visit public_send("project_#{issuable_type}_path", project, issuable) - - preview_note('/spend 1d 2h 3m') - - expect(page).not_to have_content '/spend' - expect(page).to have_content 'Adds 1d 2h 3m spent time.' - end - end -end diff --git a/spec/support/shared_examples/quick_actions/issuable/subscribe_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/subscribe_quick_action_shared_examples.rb deleted file mode 100644 index 15aefd511a5..00000000000 --- a/spec/support/shared_examples/quick_actions/issuable/subscribe_quick_action_shared_examples.rb +++ /dev/null @@ -1,84 +0,0 @@ -# frozen_string_literal: true - -shared_examples 'subscribe quick action' do |issuable_type| - before do - project.add_maintainer(maintainer) - gitlab_sign_in(maintainer) - end - - context "new #{issuable_type}", :js do - before do - case issuable_type - when :merge_request - visit public_send('namespace_project_new_merge_request_path', project.namespace, project, new_url_opts) - wait_for_all_requests - when :issue - visit public_send('new_namespace_project_issue_path', project.namespace, project, new_url_opts) - wait_for_all_requests - end - end - - it "creates the #{issuable_type} and interprets subscribe quick action accordingly" do - fill_in "#{issuable_type}_title", with: 'bug 345' - fill_in "#{issuable_type}_description", with: "bug description\n/subscribe" - click_button "Submit #{issuable_type}".humanize - - issuable = project.public_send(issuable_type.to_s.pluralize).first - - expect(issuable.description).to eq 'bug description' - expect(issuable).to be_opened - expect(page).to have_content 'bug 345' - expect(page).to have_content 'bug description' - expect(issuable.subscribed?(maintainer, project)).to be_truthy - end - end - - context "post note to existing #{issuable_type}" do - before do - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - expect(issuable.subscribed?(maintainer, project)).to be_falsy - end - - it 'creates the note and interprets the subscribe quick action accordingly' do - add_note('/subscribe') - - wait_for_requests - expect(page).not_to have_content '/subscribe' - expect(page).to have_content 'Commands applied' - expect(issuable.subscribed?(maintainer, project)).to be_truthy - end - - context "when current user cannot subscribe to #{issuable_type}" do - before do - guest = create(:user) - project.add_guest(guest) - - gitlab_sign_out - gitlab_sign_in(guest) - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it "does not subscribe to the #{issuable_type}" do - add_note('/subscribe') - - wait_for_requests - expect(page).not_to have_content '/subscribe' - expect(page).to have_content 'Commands applied' - expect(issuable.subscribed?(maintainer, project)).to be_falsy - end - end - end - - context "preview of note on #{issuable_type}", :js do - it 'explains subscribe quick action' do - visit public_send("project_#{issuable_type}_path", project, issuable) - - preview_note('/subscribe') - - expect(page).not_to have_content '/subscribe' - expect(page).to have_content "Subscribes to this #{issuable_type.to_s.humanize.downcase}" - end - end -end diff --git a/spec/support/shared_examples/quick_actions/issuable/tableflip_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/tableflip_quick_action_shared_examples.rb deleted file mode 100644 index c174127c4ff..00000000000 --- a/spec/support/shared_examples/quick_actions/issuable/tableflip_quick_action_shared_examples.rb +++ /dev/null @@ -1,60 +0,0 @@ -# frozen_string_literal: true - -shared_examples 'tableflip quick action' do |issuable_type| - before do - project.add_maintainer(maintainer) - gitlab_sign_in(maintainer) - end - - context "new #{issuable_type}", :js do - before do - case issuable_type - when :merge_request - visit public_send('namespace_project_new_merge_request_path', project.namespace, project, new_url_opts) - wait_for_all_requests - when :issue - visit public_send('new_namespace_project_issue_path', project.namespace, project, new_url_opts) - wait_for_all_requests - end - end - - it "creates the #{issuable_type} and interprets tableflip quick action accordingly" do - fill_in "#{issuable_type}_title", with: 'bug 345' - fill_in "#{issuable_type}_description", with: "bug description\n/tableflip oops" - click_button "Submit #{issuable_type}".humanize - - issuable = project.public_send(issuable_type.to_s.pluralize).first - - expect(issuable.description).to eq "bug description\noops (╯°□°)╯︵ ┻━┻" - expect(page).to have_content 'bug 345' - expect(page).to have_content "bug description oops (╯°□°)╯︵ ┻━┻" - end - end - - context "post note to existing #{issuable_type}" do - before do - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it 'creates the note and interprets tableflip quick action accordingly' do - add_note("/tableflip oops") - - wait_for_requests - expect(page).not_to have_content '/tableflip oops' - expect(page).to have_content "oops (╯°□°)╯︵ ┻━┻" - expect(issuable.notes.last.note).to eq "oops (╯°□°)╯︵ ┻━┻" - end - end - - context "preview of note on #{issuable_type}", :js do - it 'explains tableflip quick action' do - visit public_send("project_#{issuable_type}_path", project, issuable) - - preview_note('/tableflip oops') - - expect(page).not_to have_content '/tableflip' - expect(page).to have_content "oops (╯°□°)╯︵ ┻━┻" - end - end -end diff --git a/spec/support/shared_examples/quick_actions/issuable/title_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/title_quick_action_shared_examples.rb deleted file mode 100644 index 93a69093dde..00000000000 --- a/spec/support/shared_examples/quick_actions/issuable/title_quick_action_shared_examples.rb +++ /dev/null @@ -1,85 +0,0 @@ -# frozen_string_literal: true - -shared_examples 'title quick action' do |issuable_type| - before do - project.add_maintainer(maintainer) - gitlab_sign_in(maintainer) - end - - context "new #{issuable_type}", :js do - before do - case issuable_type - when :merge_request - visit public_send('namespace_project_new_merge_request_path', project.namespace, project, new_url_opts) - wait_for_all_requests - when :issue - visit public_send('new_namespace_project_issue_path', project.namespace, project, new_url_opts) - wait_for_all_requests - end - end - - it "creates the #{issuable_type} and interprets title quick action accordingly" do - fill_in "#{issuable_type}_title", with: 'bug 345' - fill_in "#{issuable_type}_description", with: "bug description\n/title new title" - click_button "Submit #{issuable_type}".humanize - - issuable = project.public_send(issuable_type.to_s.pluralize).first - - expect(issuable.description).to eq 'bug description' - expect(issuable).to be_opened - expect(issuable.title).to eq 'bug 345' - expect(page).to have_content 'bug 345' - expect(page).to have_content 'bug description' - end - end - - context "post note to existing #{issuable_type}" do - before do - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it 'creates the note and interprets the title quick action accordingly' do - add_note('/title New title') - - wait_for_requests - expect(page).not_to have_content '/title new title' - expect(page).to have_content 'Commands applied' - expect(page).to have_content 'New title' - - issuable.reload - expect(issuable.title).to eq 'New title' - end - - context "when current user cannot set title #{issuable_type}" do - before do - guest = create(:user) - project.add_guest(guest) - - gitlab_sign_out - gitlab_sign_in(guest) - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it "does not set title to the #{issuable_type}" do - add_note('/title New title') - - expect(page).not_to have_content 'Commands applied' - expect(issuable.title).not_to eq 'New title' - end - end - end - - context "preview of note on #{issuable_type}", :js do - it 'explains title quick action' do - visit public_send("project_#{issuable_type}_path", project, issuable) - - preview_note('/title New title') - wait_for_requests - - expect(page).not_to have_content '/title New title' - expect(page).to have_content 'Changes the title to "New title".' - end - end -end diff --git a/spec/support/shared_examples/quick_actions/issuable/todo_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/todo_quick_action_shared_examples.rb deleted file mode 100644 index cccc28127ce..00000000000 --- a/spec/support/shared_examples/quick_actions/issuable/todo_quick_action_shared_examples.rb +++ /dev/null @@ -1,92 +0,0 @@ -# frozen_string_literal: true - -shared_examples 'todo quick action' do |issuable_type| - before do - project.add_maintainer(maintainer) - gitlab_sign_in(maintainer) - end - - context "new #{issuable_type}", :js do - before do - case issuable_type - when :merge_request - visit public_send('namespace_project_new_merge_request_path', project.namespace, project, new_url_opts) - wait_for_all_requests - when :issue - visit public_send('new_namespace_project_issue_path', project.namespace, project, new_url_opts) - wait_for_all_requests - end - end - - it "creates the #{issuable_type} and interprets todo quick action accordingly" do - fill_in "#{issuable_type}_title", with: 'bug 345' - fill_in "#{issuable_type}_description", with: "bug description\n/todo" - click_button "Submit #{issuable_type}".humanize - - issuable = project.public_send(issuable_type.to_s.pluralize).first - - expect(issuable.description).to eq 'bug description' - expect(issuable).to be_opened - expect(page).to have_content 'bug 345' - expect(page).to have_content 'bug description' - - todos = TodosFinder.new(maintainer).execute - expect(todos.size).to eq 0 - end - end - - context "post note to existing #{issuable_type}" do - before do - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it 'creates the note and interprets the todo quick action accordingly' do - add_note('/todo') - - wait_for_requests - expect(page).not_to have_content '/todo' - expect(page).to have_content 'Commands applied' - - todos = TodosFinder.new(maintainer).execute - todo = todos.first - - expect(todos.size).to eq 1 - expect(todo).to be_pending - expect(todo.target).to eq issuable - expect(todo.author).to eq maintainer - expect(todo.user).to eq maintainer - end - - context "when current user cannot add todo #{issuable_type}" do - before do - guest = create(:user) - project.add_guest(guest) - - gitlab_sign_out - gitlab_sign_in(guest) - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it "does not add todo the #{issuable_type}" do - add_note('/todo') - - expect(page).not_to have_content 'Commands applied' - todos = TodosFinder.new(maintainer).execute - expect(todos.size).to eq 0 - end - end - end - - context "preview of note on #{issuable_type}", :js do - it 'explains todo quick action' do - visit public_send("project_#{issuable_type}_path", project, issuable) - - preview_note('/todo') - - expect(page).not_to have_content '/todo' - expect(page).to have_content "Adds a todo." - end - end -end diff --git a/spec/support/shared_examples/quick_actions/issuable/unassign_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/unassign_quick_action_shared_examples.rb deleted file mode 100644 index 0b1a52bc860..00000000000 --- a/spec/support/shared_examples/quick_actions/issuable/unassign_quick_action_shared_examples.rb +++ /dev/null @@ -1,120 +0,0 @@ -# frozen_string_literal: true - -shared_examples 'unassign quick action' do |issuable_type| - before do - project.add_maintainer(maintainer) - gitlab_sign_in(maintainer) - end - - context "new #{issuable_type}", :js do - before do - case issuable_type - when :merge_request - visit public_send('namespace_project_new_merge_request_path', project.namespace, project, new_url_opts) - wait_for_all_requests - when :issue - visit public_send('new_namespace_project_issue_path', project.namespace, project, new_url_opts) - wait_for_all_requests - end - end - - it "creates the #{issuable_type} and interprets unassign quick action accordingly" do - fill_in "#{issuable_type}_title", with: 'bug 345' - fill_in "#{issuable_type}_description", with: "bug description\n/unassign @bob" - click_button "Submit #{issuable_type}".humanize - - issuable = project.public_send(issuable_type.to_s.pluralize).first - - expect(issuable.description).to eq 'bug description' - expect(issuable.assignees).to eq [] - expect(page).to have_content 'bug 345' - expect(page).to have_content 'bug description' - end - - it "creates the #{issuable_type} and interprets unassign quick action accordingly" do - fill_in "#{issuable_type}_title", with: 'bug 345' - fill_in "#{issuable_type}_description", with: "bug description\n/unassign me" - click_button "Submit #{issuable_type}".humanize - - issuable = project.public_send(issuable_type.to_s.pluralize).first - - expect(issuable.description).to eq 'bug description' - expect(issuable.assignees).to eq [] - expect(page).to have_content 'bug 345' - expect(page).to have_content 'bug description' - end - end - - context "post note to existing #{issuable_type}" do - before do - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it 'creates the note and interprets the unassign quick action accordingly' do - assignee = create(:user, username: 'bob') - issuable.update(assignee_ids: [assignee.id]) - expect(issuable.assignees).to eq [assignee] - - add_note("Awesome!\n\n/unassign @bob") - - expect(page).to have_content 'Awesome!' - expect(page).not_to have_content '/unassign @bob' - - wait_for_requests - issuable.reload - note = issuable.notes.user.first - - expect(note.note).to eq 'Awesome!' - expect(issuable.assignees).to eq [] - end - - it "unassigns the #{issuable_type} from current user" do - issuable.update(assignee_ids: [maintainer.id]) - expect(issuable.reload.assignees).to eq [maintainer] - expect(issuable.assignees).to eq [maintainer] - - add_note("/unassign me") - - expect(page).not_to have_content '/unassign me' - expect(page).to have_content 'Commands applied' - - expect(issuable.reload.assignees).to eq [] - end - end - - context "preview of note on #{issuable_type}", :js do - it 'explains unassign quick action: from bob' do - assignee = create(:user, username: 'bob') - issuable.update(assignee_ids: [assignee.id]) - expect(issuable.assignees).to eq [assignee] - - visit public_send("project_#{issuable_type}_path", project, issuable) - - page.within('.js-main-target-form') do - fill_in 'note[note]', with: "Awesome!\n/unassign @bob " - click_on 'Preview' - - expect(page).not_to have_content '/unassign @bob' - expect(page).to have_content 'Awesome!' - expect(page).to have_content 'Removes assignee @bob.' - end - end - - it 'explains unassign quick action: from me' do - issuable.update(assignee_ids: [maintainer.id]) - expect(issuable.assignees).to eq [maintainer] - - visit public_send("project_#{issuable_type}_path", project, issuable) - - page.within('.js-main-target-form') do - fill_in 'note[note]', with: "Awesome!\n/unassign me" - click_on 'Preview' - - expect(page).not_to have_content '/unassign me' - expect(page).to have_content 'Awesome!' - expect(page).to have_content "Removes assignee @#{maintainer.username}." - end - end - end -end diff --git a/spec/support/shared_examples/quick_actions/issuable/unlabel_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/unlabel_quick_action_shared_examples.rb deleted file mode 100644 index 1a1ee05841f..00000000000 --- a/spec/support/shared_examples/quick_actions/issuable/unlabel_quick_action_shared_examples.rb +++ /dev/null @@ -1,102 +0,0 @@ -# frozen_string_literal: true - -shared_examples 'unlabel quick action' do |issuable_type| - before do - project.add_maintainer(maintainer) - gitlab_sign_in(maintainer) - end - - context "new #{issuable_type}", :js do - before do - case issuable_type - when :merge_request - visit public_send('namespace_project_new_merge_request_path', project.namespace, project, new_url_opts) - wait_for_all_requests - when :issue - visit public_send('new_namespace_project_issue_path', project.namespace, project, new_url_opts) - wait_for_all_requests - end - end - - it "creates the #{issuable_type} and interprets unlabel quick action accordingly" do - fill_in "#{issuable_type}_title", with: 'bug 345' - fill_in "#{issuable_type}_description", with: "bug description\n/label ~bug /unlabel" - click_button "Submit #{issuable_type}".humanize - - issuable = project.public_send(issuable_type.to_s.pluralize).first - - expect(issuable.description).to eq 'bug description' - expect(issuable).to be_opened - expect(page).to have_content 'bug 345' - expect(page).to have_content 'bug description' - expect(issuable.labels).to eq [label_bug] - end - end - - context "post note to existing #{issuable_type}" do - before do - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - issuable.update(labels: [label_bug, label_feature]) - end - - it 'creates the note and interprets the unlabel all quick action accordingly' do - add_note("/unlabel") - - wait_for_requests - expect(page).not_to have_content '/unlabel' - expect(page).to have_content 'Commands applied' - expect(issuable.reload.labels).to eq [] - end - - it 'creates the note and interprets the unlabel some quick action accordingly' do - add_note("/unlabel ~bug") - - wait_for_requests - expect(page).not_to have_content '/unlabel' - expect(page).to have_content 'Commands applied' - expect(issuable.reload.labels).to match_array([label_feature]) - end - - context "when current user cannot unlabel to #{issuable_type}" do - before do - guest = create(:user) - project.add_guest(guest) - - gitlab_sign_out - gitlab_sign_in(guest) - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it 'does not unlabel' do - add_note("/unlabel") - - wait_for_requests - expect(page).not_to have_content '/unlabel' - expect(issuable.labels).to match_array([label_bug, label_feature]) - end - end - end - - context "preview of note on #{issuable_type}", :js do - before do - issuable.update(labels: [label_bug, label_feature]) - visit public_send("project_#{issuable_type}_path", project, issuable) - end - - it 'explains unlabel all quick action' do - preview_note('/unlabel') - - expect(page).not_to have_content '/unlabel' - expect(page).to have_content 'Removes all labels.' - end - - it 'explains unlabel some quick action' do - preview_note('/unlabel ~bug') - - expect(page).not_to have_content '/unlabel' - expect(page).to have_content 'Removes bug label.' - end - end -end diff --git a/spec/support/shared_examples/quick_actions/issuable/unlock_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/unlock_quick_action_shared_examples.rb deleted file mode 100644 index 998ff99b32e..00000000000 --- a/spec/support/shared_examples/quick_actions/issuable/unlock_quick_action_shared_examples.rb +++ /dev/null @@ -1,87 +0,0 @@ -# frozen_string_literal: true - -shared_examples 'unlock quick action' do |issuable_type| - before do - project.add_maintainer(maintainer) - gitlab_sign_in(maintainer) - end - - context "new #{issuable_type}", :js do - before do - case issuable_type - when :merge_request - visit public_send('namespace_project_new_merge_request_path', project.namespace, project, new_url_opts) - wait_for_all_requests - when :issue - visit public_send('new_namespace_project_issue_path', project.namespace, project, new_url_opts) - wait_for_all_requests - end - end - - it "creates the #{issuable_type} and interprets unlock quick action accordingly" do - fill_in "#{issuable_type}_title", with: 'bug 345' - fill_in "#{issuable_type}_description", with: "bug description\n/unlock" - click_button "Submit #{issuable_type}".humanize - - issuable = project.public_send(issuable_type.to_s.pluralize).first - - expect(issuable.description).to eq 'bug description' - expect(issuable).to be_opened - expect(page).to have_content 'bug 345' - expect(page).to have_content 'bug description' - expect(issuable).not_to be_discussion_locked - end - end - - context "post note to existing #{issuable_type}" do - before do - issuable.update(discussion_locked: true) - expect(issuable).to be_discussion_locked - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it 'creates the note and interprets the unlock quick action accordingly' do - add_note('/unlock') - - wait_for_requests - expect(page).not_to have_content '/unlock' - expect(page).to have_content 'Commands applied' - expect(issuable.reload).not_to be_discussion_locked - end - - context "when current user cannot unlock to #{issuable_type}" do - before do - guest = create(:user) - project.add_guest(guest) - - gitlab_sign_out - gitlab_sign_in(guest) - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it "does not lock the #{issuable_type}" do - add_note('/unlock') - - wait_for_requests - expect(page).not_to have_content '/unlock' - expect(issuable).to be_discussion_locked - end - end - end - - context "preview of note on #{issuable_type}", :js do - it 'explains unlock quick action' do - issuable.update(discussion_locked: true) - expect(issuable).to be_discussion_locked - - visit public_send("project_#{issuable_type}_path", project, issuable) - - preview_note('/unlock') - - expect(page).not_to have_content '/unlock' - expect(page).to have_content 'Unlocks the discussion' - end - end -end diff --git a/spec/support/shared_examples/quick_actions/issuable/unsubscribe_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/unsubscribe_quick_action_shared_examples.rb deleted file mode 100644 index bd92f133889..00000000000 --- a/spec/support/shared_examples/quick_actions/issuable/unsubscribe_quick_action_shared_examples.rb +++ /dev/null @@ -1,86 +0,0 @@ -# frozen_string_literal: true - -shared_examples 'unsubscribe quick action' do |issuable_type| - before do - project.add_maintainer(maintainer) - gitlab_sign_in(maintainer) - end - - context "new #{issuable_type}", :js do - before do - case issuable_type - when :merge_request - visit public_send('namespace_project_new_merge_request_path', project.namespace, project, new_url_opts) - wait_for_all_requests - when :issue - visit public_send('new_namespace_project_issue_path', project.namespace, project, new_url_opts) - wait_for_all_requests - end - end - - it "creates the #{issuable_type} and interprets unsubscribe quick action accordingly" do - fill_in "#{issuable_type}_title", with: 'bug 345' - fill_in "#{issuable_type}_description", with: "bug description\n/unsubscribe" - click_button "Submit #{issuable_type}".humanize - - issuable = project.public_send(issuable_type.to_s.pluralize).first - - expect(issuable.description).to eq 'bug description' - expect(issuable).to be_opened - expect(page).to have_content 'bug 345' - expect(page).to have_content 'bug description' - expect(issuable.subscribed?(maintainer, project)).to be_truthy - end - end - - context "post note to existing #{issuable_type}" do - before do - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - issuable.subscribe(maintainer, project) - expect(issuable.subscribed?(maintainer, project)).to be_truthy - end - - it 'creates the note and interprets the unsubscribe quick action accordingly' do - add_note('/unsubscribe') - - wait_for_requests - expect(page).not_to have_content '/unsubscribe' - expect(page).to have_content 'Commands applied' - expect(issuable.subscribed?(maintainer, project)).to be_falsey - end - - context "when current user cannot unsubscribe to #{issuable_type}" do - before do - guest = create(:user) - project.add_guest(guest) - - gitlab_sign_out - gitlab_sign_in(guest) - visit public_send("project_#{issuable_type}_path", project, issuable) - wait_for_all_requests - end - - it "does not unsubscribe to the #{issuable_type}" do - add_note('/unsubscribe') - - wait_for_requests - expect(page).not_to have_content '/unsubscribe' - expect(issuable.subscribed?(maintainer, project)).to be_truthy - end - end - end - - context "preview of note on #{issuable_type}", :js do - it 'explains unsubscribe quick action' do - visit public_send("project_#{issuable_type}_path", project, issuable) - issuable.subscribe(maintainer, project) - expect(issuable.subscribed?(maintainer, project)).to be_truthy - - preview_note('/unsubscribe') - - expect(page).not_to have_content '/unsubscribe' - expect(page).to have_content "Unsubscribes from this #{issuable_type.to_s.humanize.downcase}." - end - end -end |