diff options
Diffstat (limited to 'spec/features/issues_spec.rb')
-rw-r--r-- | spec/features/issues_spec.rb | 80 |
1 files changed, 39 insertions, 41 deletions
diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb index 87bd8a08b06..4f4bf189280 100644 --- a/spec/features/issues_spec.rb +++ b/spec/features/issues_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'Issues', feature: true do +describe 'Issues' do include DropzoneHelper include IssueHelpers include SortingHelper @@ -24,7 +24,7 @@ describe 'Issues', feature: true do end before do - visit edit_namespace_project_issue_path(project.namespace, project, issue) + visit edit_project_issue_path(project, issue) find('.js-zen-enter').click end @@ -42,7 +42,7 @@ describe 'Issues', feature: true do end it 'allows user to select unassigned', js: true do - visit edit_namespace_project_issue_path(project.namespace, project, issue) + visit edit_project_issue_path(project, issue) expect(page).to have_content "Assignee #{user.name}" @@ -62,7 +62,7 @@ describe 'Issues', feature: true do describe 'due date', js: true do context 'on new form' do before do - visit new_namespace_project_issue_path(project.namespace, project) + visit new_project_issue_path(project) end it 'saves with due date' do @@ -90,7 +90,7 @@ describe 'Issues', feature: true do let(:issue) { create(:issue, author: user, project: project, due_date: Date.today.at_beginning_of_month.to_s) } before do - visit edit_namespace_project_issue_path(project.namespace, project, issue) + visit edit_project_issue_path(project, issue) end it 'saves with due date' do @@ -135,7 +135,7 @@ describe 'Issues', feature: true do issue = create(:issue, author: user, assignees: [user], project: project, title: 'foobar') create(:award_emoji, awardable: issue) - visit namespace_project_issues_path(project.namespace, project, assignee_id: user.id) + visit project_issues_path(project, assignee_id: user.id) expect(page).to have_content 'foobar' expect(page.all('.no-comments').first.text).to eq "0" @@ -161,7 +161,7 @@ describe 'Issues', feature: true do let(:issue) { @issue } it 'allows filtering by issues with no specified assignee' do - visit namespace_project_issues_path(project.namespace, project, assignee_id: IssuableFinder::NONE) + visit project_issues_path(project, assignee_id: IssuableFinder::NONE) expect(page).to have_content 'foobar' expect(page).not_to have_content 'barbaz' @@ -169,7 +169,7 @@ describe 'Issues', feature: true do end it 'allows filtering by a specified assignee' do - visit namespace_project_issues_path(project.namespace, project, assignee_id: user.id) + visit project_issues_path(project, assignee_id: user.id) expect(page).not_to have_content 'foobar' expect(page).to have_content 'barbaz' @@ -190,14 +190,14 @@ describe 'Issues', feature: true do let(:later_due_milestone) { create(:milestone, due_date: '2013-12-12') } it 'sorts by newest' do - visit namespace_project_issues_path(project.namespace, project, sort: sort_value_recently_created) + visit project_issues_path(project, sort: sort_value_recently_created) expect(first_issue).to include('foo') expect(last_issue).to include('baz') end it 'sorts by oldest' do - visit namespace_project_issues_path(project.namespace, project, sort: sort_value_oldest_created) + visit project_issues_path(project, sort: sort_value_oldest_created) expect(first_issue).to include('baz') expect(last_issue).to include('foo') @@ -206,7 +206,7 @@ describe 'Issues', feature: true do it 'sorts by most recently updated' do baz.updated_at = Time.now + 100 baz.save - visit namespace_project_issues_path(project.namespace, project, sort: sort_value_recently_updated) + visit project_issues_path(project, sort: sort_value_recently_updated) expect(first_issue).to include('baz') end @@ -214,7 +214,7 @@ describe 'Issues', feature: true do it 'sorts by least recently updated' do baz.updated_at = Time.now - 100 baz.save - visit namespace_project_issues_path(project.namespace, project, sort: sort_value_oldest_updated) + visit project_issues_path(project, sort: sort_value_oldest_updated) expect(first_issue).to include('baz') end @@ -226,13 +226,13 @@ describe 'Issues', feature: true do end it 'sorts by recently due date' do - visit namespace_project_issues_path(project.namespace, project, sort: sort_value_due_date_soon) + visit project_issues_path(project, sort: sort_value_due_date_soon) expect(first_issue).to include('foo') end it 'sorts by least recently due date' do - visit namespace_project_issues_path(project.namespace, project, sort: sort_value_due_date_later) + visit project_issues_path(project, sort: sort_value_due_date_later) expect(first_issue).to include('bar') end @@ -240,7 +240,7 @@ describe 'Issues', feature: true do it 'sorts by least recently due date by excluding nil due dates' do bar.update(due_date: nil) - visit namespace_project_issues_path(project.namespace, project, sort: sort_value_due_date_later) + visit project_issues_path(project, sort: sort_value_due_date_later) expect(first_issue).to include('foo') end @@ -255,7 +255,7 @@ describe 'Issues', feature: true do it 'sorts by least recently due date by excluding nil due dates' do bar.update(due_date: nil) - visit namespace_project_issues_path(project.namespace, project, label_names: [label.name], sort: sort_value_due_date_later) + visit project_issues_path(project, label_names: [label.name], sort: sort_value_due_date_later) expect(first_issue).to include('foo') end @@ -269,7 +269,7 @@ describe 'Issues', feature: true do end it 'filters by none' do - visit namespace_project_issues_path(project.namespace, project, due_date: Issue::NoDueDate.name) + visit project_issues_path(project, due_date: Issue::NoDueDate.name) expect(page).not_to have_content('foo') expect(page).not_to have_content('bar') @@ -277,7 +277,7 @@ describe 'Issues', feature: true do end it 'filters by any' do - visit namespace_project_issues_path(project.namespace, project, due_date: Issue::AnyDueDate.name) + visit project_issues_path(project, due_date: Issue::AnyDueDate.name) expect(page).to have_content('foo') expect(page).to have_content('bar') @@ -289,7 +289,7 @@ describe 'Issues', feature: true do bar.update(due_date: Date.today.end_of_week) baz.update(due_date: Date.today - 8.days) - visit namespace_project_issues_path(project.namespace, project, due_date: Issue::DueThisWeek.name) + visit project_issues_path(project, due_date: Issue::DueThisWeek.name) expect(page).to have_content('foo') expect(page).to have_content('bar') @@ -301,7 +301,7 @@ describe 'Issues', feature: true do bar.update(due_date: Date.today.end_of_month) baz.update(due_date: Date.today - 50.days) - visit namespace_project_issues_path(project.namespace, project, due_date: Issue::DueThisMonth.name) + visit project_issues_path(project, due_date: Issue::DueThisMonth.name) expect(page).to have_content('foo') expect(page).to have_content('bar') @@ -313,7 +313,7 @@ describe 'Issues', feature: true do bar.update(due_date: Date.today + 20.days) baz.update(due_date: Date.yesterday) - visit namespace_project_issues_path(project.namespace, project, due_date: Issue::Overdue.name) + visit project_issues_path(project, due_date: Issue::Overdue.name) expect(page).not_to have_content('foo') expect(page).not_to have_content('bar') @@ -330,14 +330,14 @@ describe 'Issues', feature: true do end it 'sorts by recently due milestone' do - visit namespace_project_issues_path(project.namespace, project, sort: sort_value_milestone_soon) + visit project_issues_path(project, sort: sort_value_milestone_soon) expect(first_issue).to include('foo') expect(last_issue).to include('baz') end it 'sorts by least recently due milestone' do - visit namespace_project_issues_path(project.namespace, project, sort: sort_value_milestone_later) + visit project_issues_path(project, sort: sort_value_milestone_later) expect(first_issue).to include('bar') expect(last_issue).to include('baz') @@ -355,7 +355,7 @@ describe 'Issues', feature: true do end it 'sorts with a filter applied' do - visit namespace_project_issues_path(project.namespace, project, + visit project_issues_path(project, sort: sort_value_oldest_created, assignee_id: user2.id) @@ -397,7 +397,7 @@ describe 'Issues', feature: true do let!(:label) { create(:label, project: project) } before do - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) end it 'will not send ajax request when no data is changed' do @@ -416,7 +416,7 @@ describe 'Issues', feature: true do context 'by authorized user' do it 'allows user to select unassigned', js: true do - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) page.within('.assignee') do expect(page).to have_content "#{user.name}" @@ -435,7 +435,7 @@ describe 'Issues', feature: true do it 'allows user to select an assignee', js: true do issue2 = create(:issue, project: project, author: user) - visit namespace_project_issue_path(project.namespace, project, issue2) + visit project_issue_path(project, issue2) page.within('.assignee') do expect(page).to have_content "No assignee" @@ -456,7 +456,7 @@ describe 'Issues', feature: true do it 'allows user to unselect themselves', js: true do issue2 = create(:issue, project: project, author: user) - visit namespace_project_issue_path(project.namespace, project, issue2) + visit project_issue_path(project, issue2) page.within '.assignee' do click_link 'Edit' @@ -487,7 +487,7 @@ describe 'Issues', feature: true do sign_out(:user) sign_in(guest) - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) expect(page).to have_content issue.assignees.first.name end end @@ -499,7 +499,7 @@ describe 'Issues', feature: true do context 'by authorized user' do it 'allows user to select unassigned', js: true do - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) page.within('.milestone') do expect(page).to have_content "None" @@ -517,7 +517,7 @@ describe 'Issues', feature: true do end it 'allows user to de-select milestone', js: true do - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) page.within('.milestone') do click_link 'Edit' @@ -550,7 +550,7 @@ describe 'Issues', feature: true do sign_out(:user) sign_in(guest) - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) expect(page).to have_content milestone.title end end @@ -565,23 +565,21 @@ describe 'Issues', feature: true do end it 'redirects to signin then back to new issue after signin' do - visit namespace_project_issues_path(project.namespace, project) + visit project_issues_path(project) click_link 'New issue' expect(current_path).to eq new_user_session_path - # NOTE: This is specifically testing the redirect after login, so we - # need the full login flow gitlab_sign_in(create(:user)) - expect(current_path).to eq new_namespace_project_issue_path(project.namespace, project) + expect(current_path).to eq new_project_issue_path(project) end end context 'dropzone upload file', js: true do before do - visit new_namespace_project_issue_path(project.namespace, project) + visit new_project_issue_path(project) end it 'uploads file when dragging into textarea' do @@ -608,7 +606,7 @@ describe 'Issues', feature: true do message: 'added issue template', branch_name: 'master') - visit new_namespace_project_issue_path(project.namespace, project, issuable_template: 'bug') + visit new_project_issue_path(project, issuable_template: 'bug') end it 'fills in template' do @@ -625,7 +623,7 @@ describe 'Issues', feature: true do project.issues << issue stub_incoming_email_setting(enabled: true, address: "p+%{key}@gl.ab") - visit namespace_project_issues_path(project.namespace, project) + visit project_issues_path(project) click_button('Email a new issue') end @@ -654,7 +652,7 @@ describe 'Issues', feature: true do let(:issue) { create(:issue, project: project, author: user, assignees: [user]) } before do - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) end it 'adds due date to issue' do @@ -698,7 +696,7 @@ describe 'Issues', feature: true do it 'updates the title', js: true do issue = create(:issue, author: user, assignees: [user], project: project, title: 'new title') - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) expect(page).to have_text("new title") |