diff options
author | Stan Hu <stanhu@gmail.com> | 2017-08-02 16:58:28 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-08-02 16:58:28 -0700 |
commit | 408df2edcbd5f3f93ef5541bac9de2b71ba4f0ea (patch) | |
tree | 708ae61f9683b48f436f7577d1fad98f30e100fc /spec/support/features | |
parent | 3f81586ef0ab20533b8da1213bd9f60e1786dbaa (diff) | |
parent | faa2a123911eaf84bb57163ea7af759d4632601b (diff) | |
download | gitlab-ce-408df2edcbd5f3f93ef5541bac9de2b71ba4f0ea.tar.gz |
Merge branch 'master' into sh-headless-chrome-support
Diffstat (limited to 'spec/support/features')
-rw-r--r-- | spec/support/features/issuable_slash_commands_shared_examples.rb | 41 | ||||
-rw-r--r-- | spec/support/features/rss_shared_examples.rb | 4 |
2 files changed, 31 insertions, 14 deletions
diff --git a/spec/support/features/issuable_slash_commands_shared_examples.rb b/spec/support/features/issuable_slash_commands_shared_examples.rb index 50869099bb7..035428a7d9b 100644 --- a/spec/support/features/issuable_slash_commands_shared_examples.rb +++ b/spec/support/features/issuable_slash_commands_shared_examples.rb @@ -5,8 +5,6 @@ shared_examples 'issuable record that supports quick actions in its description include QuickActionsHelpers let(:master) { create(:user) } - let(:assignee) { create(:user, username: 'bob') } - let(:guest) { create(:user) } let(:project) { create(:project, :public) } let!(:milestone) { create(:milestone, project: project, title: 'ASAP') } let!(:label_bug) { create(:label, project: project, title: 'bug') } @@ -15,9 +13,8 @@ shared_examples 'issuable record that supports quick actions in its description before do project.team << [master, :master] - project.team << [assignee, :developer] - project.team << [guest, :guest] - gitlab_sign_in(master) + + sign_in(master) end after do @@ -28,7 +25,12 @@ shared_examples 'issuable record that supports quick actions in its description describe "new #{issuable_type}", js: true do context 'with commands in the description' do it "creates the #{issuable_type} and interpret commands accordingly" do - visit public_send("new_namespace_project_#{issuable_type}_path", project.namespace, project, new_url_opts) + case issuable_type + when :merge_request + visit public_send("namespace_project_new_merge_request_path", project.namespace, project, new_url_opts) + when :issue + visit public_send("new_namespace_project_issue_path", project.namespace, project, new_url_opts) + end fill_in "#{issuable_type}_title", with: 'bug 345' fill_in "#{issuable_type}_description", with: "bug description\n/label ~bug\n/milestone %\"ASAP\"" click_button "Submit #{issuable_type}".humanize @@ -51,6 +53,7 @@ shared_examples 'issuable record that supports quick actions in its description context 'with a note containing commands' do it 'creates a note without the commands and interpret the commands accordingly' do + assignee = create(:user, username: 'bob') write_note("Awesome!\n/assign @bob\n/label ~bug\n/milestone %\"ASAP\"") expect(page).to have_content 'Awesome!' @@ -71,6 +74,7 @@ shared_examples 'issuable record that supports quick actions in its description context 'with a note containing only commands' do it 'does not create a note but interpret the commands accordingly' do + assignee = create(:user, username: 'bob') write_note("/assign @bob\n/label ~bug\n/milestone %\"ASAP\"") expect(page).not_to have_content '/assign @bob' @@ -105,8 +109,12 @@ shared_examples 'issuable record that supports quick actions in its description context "when current user cannot close #{issuable_type}" do before do - gitlab_sign_out - gitlab_sign_in(guest) + guest = create(:user) + project.add_guest(guest) + + sign_out(:user) + sign_in(guest) + visit public_send("namespace_project_#{issuable_type}_path", project.namespace, project, issuable) end @@ -140,8 +148,12 @@ shared_examples 'issuable record that supports quick actions in its description context "when current user cannot reopen #{issuable_type}" do before do - gitlab_sign_out - gitlab_sign_in(guest) + guest = create(:user) + project.add_guest(guest) + + sign_out(:user) + sign_in(guest) + visit public_send("namespace_project_#{issuable_type}_path", project.namespace, project, issuable) end @@ -170,8 +182,11 @@ shared_examples 'issuable record that supports quick actions in its description context "when current user cannot change title of #{issuable_type}" do before do - gitlab_sign_out - gitlab_sign_in(guest) + guest = create(:user) + project.add_guest(guest) + + sign_out(:user) + sign_in(guest) visit public_send("namespace_project_#{issuable_type}_path", project.namespace, project, issuable) end @@ -261,6 +276,8 @@ shared_examples 'issuable record that supports quick actions in its description describe "preview of note on #{issuable_type}" do it 'removes quick actions from note and explains them' do + create(:user, username: 'bob') + visit public_send("namespace_project_#{issuable_type}_path", project.namespace, project, issuable) page.within('.js-main-target-form') do diff --git a/spec/support/features/rss_shared_examples.rb b/spec/support/features/rss_shared_examples.rb index 1cbb4134995..50fbbc7f55b 100644 --- a/spec/support/features/rss_shared_examples.rb +++ b/spec/support/features/rss_shared_examples.rb @@ -1,12 +1,12 @@ shared_examples "an autodiscoverable RSS feed with current_user's RSS token" do it "has an RSS autodiscovery link tag with current_user's RSS token" do - expect(page).to have_css("link[type*='atom+xml'][href*='rss_token=#{Thread.current[:current_user].rss_token}']", visible: false) + expect(page).to have_css("link[type*='atom+xml'][href*='rss_token=#{user.rss_token}']", visible: false) end end shared_examples "it has an RSS button with current_user's RSS token" do it "shows the RSS button with current_user's RSS token" do - expect(page).to have_css("a:has(.fa-rss)[href*='rss_token=#{Thread.current[:current_user].rss_token}']") + expect(page).to have_css("a:has(.fa-rss)[href*='rss_token=#{user.rss_token}']") end end |