diff options
Diffstat (limited to 'spec/features/merge_requests')
36 files changed, 109 insertions, 145 deletions
diff --git a/spec/features/merge_requests/assign_issues_spec.rb b/spec/features/merge_requests/assign_issues_spec.rb index 90410fcbc93..985f42e484c 100644 --- a/spec/features/merge_requests/assign_issues_spec.rb +++ b/spec/features/merge_requests/assign_issues_spec.rb @@ -14,7 +14,7 @@ feature 'Merge request issue assignment', js: true, feature: true do def visit_merge_request(current_user = nil) sign_in(current_user || user) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end context 'logged in as author' do diff --git a/spec/features/merge_requests/award_spec.rb b/spec/features/merge_requests/award_spec.rb index 7add201c587..3b01c763281 100644 --- a/spec/features/merge_requests/award_spec.rb +++ b/spec/features/merge_requests/award_spec.rb @@ -8,7 +8,7 @@ feature 'Merge request awards', js: true, feature: true do describe 'logged in' do before do sign_in(user) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'adds award to merge request' do @@ -16,7 +16,7 @@ feature 'Merge request awards', js: true, feature: true do expect(page).to have_selector('.js-emoji-btn.active') expect(first('.js-emoji-btn')).to have_content '1' - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) expect(first('.js-emoji-btn')).to have_content '1' end @@ -25,7 +25,7 @@ feature 'Merge request awards', js: true, feature: true do find('.js-emoji-btn.active').click expect(first('.js-emoji-btn')).to have_content '0' - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) expect(first('.js-emoji-btn')).to have_content '0' end @@ -39,7 +39,7 @@ feature 'Merge request awards', js: true, feature: true do describe 'logged out' do before do - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'does not see award menu button' do diff --git a/spec/features/merge_requests/check_if_mergeable_with_unresolved_discussions_spec.rb b/spec/features/merge_requests/check_if_mergeable_with_unresolved_discussions_spec.rb index be986d4304f..f2d6c0d9769 100644 --- a/spec/features/merge_requests/check_if_mergeable_with_unresolved_discussions_spec.rb +++ b/spec/features/merge_requests/check_if_mergeable_with_unresolved_discussions_spec.rb @@ -64,6 +64,6 @@ feature 'Check if mergeable with unresolved discussions', js: true, feature: tru end def visit_merge_request(merge_request) - visit namespace_project_merge_request_path(merge_request.project.namespace, merge_request.project, merge_request) + visit project_merge_request_path(merge_request.project, merge_request) end end diff --git a/spec/features/merge_requests/cherry_pick_spec.rb b/spec/features/merge_requests/cherry_pick_spec.rb index 7731f87cb78..e4c33d57e8d 100644 --- a/spec/features/merge_requests/cherry_pick_spec.rb +++ b/spec/features/merge_requests/cherry_pick_spec.rb @@ -28,7 +28,7 @@ describe 'Cherry-pick Merge Requests', js: true do end it "doesn't show a Cherry-pick button" do - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) expect(page).not_to have_link "Cherry-pick" end @@ -36,7 +36,7 @@ describe 'Cherry-pick Merge Requests', js: true do context "With a merge commit" do it "shows a Cherry-pick button" do - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) expect(page).to have_link "Cherry-pick" end diff --git a/spec/features/merge_requests/closes_issues_spec.rb b/spec/features/merge_requests/closes_issues_spec.rb index 89c0cdbde37..527837b56be 100644 --- a/spec/features/merge_requests/closes_issues_spec.rb +++ b/spec/features/merge_requests/closes_issues_spec.rb @@ -22,7 +22,7 @@ feature 'Merge Request closing issues message', feature: true, js: true do sign_in user - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) wait_for_requests end diff --git a/spec/features/merge_requests/conflicts_spec.rb b/spec/features/merge_requests/conflicts_spec.rb index 751799c15a7..3e01ea69122 100644 --- a/spec/features/merge_requests/conflicts_spec.rb +++ b/spec/features/merge_requests/conflicts_spec.rb @@ -86,7 +86,7 @@ feature 'Merge request conflict resolution', js: true, feature: true do let(:merge_request) { create_merge_request('conflict-resolvable') } before do - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'shows a link to the conflict resolution page' do @@ -117,7 +117,7 @@ feature 'Merge request conflict resolution', js: true, feature: true do let(:merge_request) { create_merge_request('conflict-contains-conflict-markers') } before do - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) click_link('conflicts', href: /\/conflicts\Z/) end @@ -166,7 +166,7 @@ feature 'Merge request conflict resolution', js: true, feature: true do project.team << [user, :developer] sign_in(user) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'does not show a link to the conflict resolution page' do diff --git a/spec/features/merge_requests/create_new_mr_spec.rb b/spec/features/merge_requests/create_new_mr_spec.rb index 3022a106d31..235d8588e1e 100644 --- a/spec/features/merge_requests/create_new_mr_spec.rb +++ b/spec/features/merge_requests/create_new_mr_spec.rb @@ -11,7 +11,7 @@ feature 'Create New Merge Request', feature: true, js: true do end it 'selects the source branch sha when a tag with the same name exists' do - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) click_link 'New merge request' expect(page).to have_content('Source branch') @@ -24,7 +24,7 @@ feature 'Create New Merge Request', feature: true, js: true do end it 'selects the target branch sha when a tag with the same name exists' do - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) click_link 'New merge request' @@ -38,7 +38,7 @@ feature 'Create New Merge Request', feature: true, js: true do end it 'generates a diff for an orphaned branch' do - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) page.has_link?('New Merge Request') ? click_link("New Merge Request") : click_link('New merge request') expect(page).to have_content('Source branch') @@ -65,7 +65,7 @@ feature 'Create New Merge Request', feature: true, js: true do it 'does not leak the private project name & namespace' do private_project = create(:project, :private) - visit namespace_project_new_merge_request_path(project.namespace, project, merge_request: { target_project_id: private_project.id }) + visit project_new_merge_request_path(project, merge_request: { target_project_id: private_project.id }) expect(page).not_to have_content private_project.path_with_namespace expect(page).to have_content project.path_with_namespace @@ -76,7 +76,7 @@ feature 'Create New Merge Request', feature: true, js: true do it 'does not leak the private project name & namespace' do private_project = create(:project, :private) - visit namespace_project_new_merge_request_path(project.namespace, project, merge_request: { source_project_id: private_project.id }) + visit project_new_merge_request_path(project, merge_request: { source_project_id: private_project.id }) expect(page).not_to have_content private_project.path_with_namespace expect(page).to have_content project.path_with_namespace @@ -84,13 +84,13 @@ feature 'Create New Merge Request', feature: true, js: true do end it 'populates source branch button' do - visit namespace_project_new_merge_request_path(project.namespace, project, change_branches: true, merge_request: { target_branch: 'master', source_branch: 'fix' }) + visit project_new_merge_request_path(project, change_branches: true, merge_request: { target_branch: 'master', source_branch: 'fix' }) expect(find('.js-source-branch')).to have_content('fix') end it 'allows to change the diff view' do - visit namespace_project_new_merge_request_path(project.namespace, project, merge_request: { target_branch: 'master', source_branch: 'fix' }) + visit project_new_merge_request_path(project, merge_request: { target_branch: 'master', source_branch: 'fix' }) click_link 'Changes' @@ -106,7 +106,7 @@ feature 'Create New Merge Request', feature: true, js: true do end it 'does not allow non-existing branches' do - visit namespace_project_new_merge_request_path(project.namespace, project, merge_request: { target_branch: 'non-exist-target', source_branch: 'non-exist-source' }) + visit project_new_merge_request_path(project, merge_request: { target_branch: 'non-exist-target', source_branch: 'non-exist-source' }) expect(page).to have_content('The form contains the following errors') expect(page).to have_content('Source branch "non-exist-source" does not exist') @@ -115,7 +115,7 @@ feature 'Create New Merge Request', feature: true, js: true do context 'when a branch contains commits that both delete and add the same image' do it 'renders the diff successfully' do - visit namespace_project_new_merge_request_path(project.namespace, project, merge_request: { target_branch: 'master', source_branch: 'deleted-image-test' }) + visit project_new_merge_request_path(project, merge_request: { target_branch: 'master', source_branch: 'deleted-image-test' }) click_link "Changes" @@ -125,7 +125,7 @@ feature 'Create New Merge Request', feature: true, js: true do # Isolates a regression (see #24627) it 'does not show error messages on initial form' do - visit namespace_project_new_merge_request_path(project.namespace, project) + visit project_new_merge_request_path(project) expect(page).not_to have_selector('#error_explanation') expect(page).not_to have_content('The form contains the following error') end @@ -138,9 +138,7 @@ feature 'Create New Merge Request', feature: true, js: true do end it 'shows pipelines for a new merge request' do - visit namespace_project_new_merge_request_path( - project.namespace, project, - merge_request: { target_branch: 'master', source_branch: 'fix' }) + visit project_new_merge_request_path(project, merge_request: { target_branch: 'master', source_branch: 'fix' }) page.within('.merge-request') do click_link 'Pipelines' diff --git a/spec/features/merge_requests/created_from_fork_spec.rb b/spec/features/merge_requests/created_from_fork_spec.rb index 2dd96a9b5f4..9b7795ace62 100644 --- a/spec/features/merge_requests/created_from_fork_spec.rb +++ b/spec/features/merge_requests/created_from_fork_spec.rb @@ -64,7 +64,6 @@ feature 'Merge request created from fork' do end def visit_merge_request(mr) - visit namespace_project_merge_request_path(project.namespace, - project, mr) + visit project_merge_request_path(project, mr) end end diff --git a/spec/features/merge_requests/deleted_source_branch_spec.rb b/spec/features/merge_requests/deleted_source_branch_spec.rb index bec14b41fb7..8d7160e2df2 100644 --- a/spec/features/merge_requests/deleted_source_branch_spec.rb +++ b/spec/features/merge_requests/deleted_source_branch_spec.rb @@ -11,11 +11,7 @@ describe 'Deleted source branch', feature: true, js: true do sign_in user merge_request.project.team << [user, :master] merge_request.update!(source_branch: 'this-branch-does-not-exist') - visit namespace_project_merge_request_path( - merge_request.project.namespace, - merge_request.project, - merge_request - ) + visit project_merge_request_path(merge_request.project, merge_request) end it 'shows a message about missing source branch' do diff --git a/spec/features/merge_requests/diff_notes_avatars_spec.rb b/spec/features/merge_requests/diff_notes_avatars_spec.rb index 62b6f2ec3c1..4fc70027193 100644 --- a/spec/features/merge_requests/diff_notes_avatars_spec.rb +++ b/spec/features/merge_requests/diff_notes_avatars_spec.rb @@ -25,7 +25,7 @@ feature 'Diff note avatars', feature: true, js: true do context 'discussion tab' do before do - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'does not show avatars on discussion tab' do @@ -50,7 +50,7 @@ feature 'Diff note avatars', feature: true, js: true do context 'commit view' do before do - visit namespace_project_commit_path(project.namespace, project, merge_request.commits.first.id) + visit project_commit_path(project, merge_request.commits.first.id) end it 'does not render avatar after commenting' do @@ -65,7 +65,7 @@ feature 'Diff note avatars', feature: true, js: true do wait_for_requests end - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) expect(page).to have_content('test comment') expect(page).not_to have_selector('.js-avatar-container') @@ -76,7 +76,7 @@ feature 'Diff note avatars', feature: true, js: true do %w(inline parallel).each do |view| context "#{view} view" do before do - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, view: view) + visit diffs_project_merge_request_path(project, merge_request, view: view) wait_for_requests end @@ -168,7 +168,7 @@ feature 'Diff note avatars', feature: true, js: true do before do create_list(:diff_note_on_merge_request, 3, project: project, noteable: merge_request, in_reply_to: note) - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, view: view) + visit diffs_project_merge_request_path(project, merge_request, view: view) wait_for_requests end diff --git a/spec/features/merge_requests/diff_notes_resolve_spec.rb b/spec/features/merge_requests/diff_notes_resolve_spec.rb index 617448a4547..93e2d134389 100644 --- a/spec/features/merge_requests/diff_notes_resolve_spec.rb +++ b/spec/features/merge_requests/diff_notes_resolve_spec.rb @@ -494,6 +494,6 @@ feature 'Diff notes resolve', feature: true, js: true do def visit_merge_request(mr = nil) mr = mr || merge_request - visit namespace_project_merge_request_path(mr.project.namespace, mr.project, mr) + visit project_merge_request_path(mr.project, mr) end end diff --git a/spec/features/merge_requests/diffs_spec.rb b/spec/features/merge_requests/diffs_spec.rb index bfcec08a730..d9de4e388d5 100644 --- a/spec/features/merge_requests/diffs_spec.rb +++ b/spec/features/merge_requests/diffs_spec.rb @@ -12,7 +12,7 @@ feature 'Diffs URL', js: true, feature: true do it 'renders the notes' do create :note_on_merge_request, project: project, noteable: merge_request, note: 'Rebasing with master' - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request) + visit diffs_project_merge_request_path(project, merge_request) # Load notes and diff through AJAX expect(page).to have_css('.note-text', visible: false, text: 'Rebasing with master') @@ -26,7 +26,7 @@ feature 'Diffs URL', js: true, feature: true do let(:fragment) { "#note_#{note.id}" } before do - visit "#{diffs_namespace_project_merge_request_path(project.namespace, project, merge_request)}#{fragment}" + visit "#{diffs_project_merge_request_path(project, merge_request)}#{fragment}" end it 'shows expanded note' do @@ -39,7 +39,7 @@ feature 'Diffs URL', js: true, feature: true do let(:fragment) { "#note_#{note.id}" } before do - visit "#{diffs_namespace_project_merge_request_path(project.namespace, project, merge_request)}#{fragment}" + visit "#{diffs_project_merge_request_path(project, merge_request)}#{fragment}" end it 'shows expanded note' do @@ -52,7 +52,7 @@ feature 'Diffs URL', js: true, feature: true do it 'displays warning' do allow(Commit).to receive(:max_diff_options).and_return(max_files: 3) - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request) + visit diffs_project_merge_request_path(project, merge_request) page.within('.alert') do expect(page).to have_text("Too many changes to show. Plain diff Email patch To preserve @@ -75,7 +75,7 @@ feature 'Diffs URL', js: true, feature: true do context 'as author' do it 'shows direct edit link' do sign_in(author_user) - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request) + visit diffs_project_merge_request_path(project, merge_request) # Throws `Capybara::Poltergeist::InvalidSelector` if we try to use `#hash` syntax expect(page).to have_selector("[id=\"#{changelog_id}\"] a.js-edit-blob") @@ -85,7 +85,7 @@ feature 'Diffs URL', js: true, feature: true do context 'as user who needs to fork' do it 'shows fork/cancel confirmation' do sign_in(user) - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request) + visit diffs_project_merge_request_path(project, merge_request) # Throws `Capybara::Poltergeist::InvalidSelector` if we try to use `#hash` syntax find("[id=\"#{changelog_id}\"] .js-edit-blob").click diff --git a/spec/features/merge_requests/discussion_spec.rb b/spec/features/merge_requests/discussion_spec.rb index 840f9968878..55846f8609b 100644 --- a/spec/features/merge_requests/discussion_spec.rb +++ b/spec/features/merge_requests/discussion_spec.rb @@ -27,13 +27,13 @@ feature 'Merge Request Discussions', feature: true do let(:outdated_diff_refs) { project.commit("874797c3a73b60d2187ed6e2fcabd289ff75171e").diff_refs } before(:each) do - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end context 'active discussions' do it 'shows a link to the diff' do within(".discussion[data-discussion-id='#{active_discussion.id}']") do - path = diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, anchor: active_discussion.line_code) + path = diffs_project_merge_request_path(project, merge_request, anchor: active_discussion.line_code) expect(page).to have_link('the diff', href: path) end end @@ -42,7 +42,7 @@ feature 'Merge Request Discussions', feature: true do context 'outdated discussions' do it 'shows a link to the outdated diff' do within(".discussion[data-discussion-id='#{outdated_discussion.id}']") do - path = diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, diff_id: old_merge_request_diff.id, anchor: outdated_discussion.line_code) + path = diffs_project_merge_request_path(project, merge_request, diff_id: old_merge_request_diff.id, anchor: outdated_discussion.line_code) expect(page).to have_link('an old version of the diff', href: path) end end @@ -72,7 +72,7 @@ feature 'Merge Request Discussions', feature: true do end before(:each) do - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end context 'a regular commit comment' do diff --git a/spec/features/merge_requests/edit_mr_spec.rb b/spec/features/merge_requests/edit_mr_spec.rb index 69f6933dbd0..b7063f35546 100644 --- a/spec/features/merge_requests/edit_mr_spec.rb +++ b/spec/features/merge_requests/edit_mr_spec.rb @@ -10,7 +10,7 @@ feature 'Edit Merge Request', feature: true do sign_in user - visit edit_namespace_project_merge_request_path(project.namespace, project, merge_request) + visit edit_project_merge_request_path(project, merge_request) end context 'editing a MR' do @@ -33,7 +33,7 @@ feature 'Edit Merge Request', feature: true do merge_request.update(merge_params: { 'force_remove_source_branch' => '1' }) expect(merge_request.merge_params['force_remove_source_branch']).to be_truthy - visit edit_namespace_project_merge_request_path(project.namespace, project, merge_request) + visit edit_project_merge_request_path(project, merge_request) uncheck 'Remove source branch when merge request is accepted' click_button 'Save changes' diff --git a/spec/features/merge_requests/filter_by_labels_spec.rb b/spec/features/merge_requests/filter_by_labels_spec.rb index 747afaf9de8..754f82900e4 100644 --- a/spec/features/merge_requests/filter_by_labels_spec.rb +++ b/spec/features/merge_requests/filter_by_labels_spec.rb @@ -28,7 +28,7 @@ feature 'Issue filtering by Labels', feature: true, js: true do project.team << [user, :master] sign_in(user) - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) end context 'filter by label bug' do diff --git a/spec/features/merge_requests/filter_merge_requests_spec.rb b/spec/features/merge_requests/filter_merge_requests_spec.rb index cd7453b4f65..2a161b83aa0 100644 --- a/spec/features/merge_requests/filter_merge_requests_spec.rb +++ b/spec/features/merge_requests/filter_merge_requests_spec.rb @@ -17,7 +17,7 @@ describe 'Filter merge requests', feature: true do sign_in(user) create(:merge_request, source_project: project, target_project: project) - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) end describe 'for assignee from mr#index' do @@ -191,7 +191,7 @@ describe 'Filter merge requests', feature: true do assignee: user) mr.labels << bug_label - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) end context 'only text', js: true do @@ -275,7 +275,7 @@ describe 'Filter merge requests', feature: true do mr1.labels << bug_label mr2.labels << bug_label - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) end it 'is able to filter and sort merge requests' do @@ -297,7 +297,7 @@ describe 'Filter merge requests', feature: true do describe 'filter by assignee id', js: true do it 'filter by current user' do - visit namespace_project_merge_requests_path(project.namespace, project, assignee_id: user.id) + visit project_merge_requests_path(project, assignee_id: user.id) expect_tokens([{ name: 'assignee', value: "@#{user.username}" }]) expect_filtered_search_input_empty @@ -307,7 +307,7 @@ describe 'Filter merge requests', feature: true do new_user = create(:user) project.add_developer(new_user) - visit namespace_project_merge_requests_path(project.namespace, project, assignee_id: new_user.id) + visit project_merge_requests_path(project, assignee_id: new_user.id) expect_tokens([{ name: 'assignee', value: "@#{new_user.username}" }]) expect_filtered_search_input_empty @@ -316,7 +316,7 @@ describe 'Filter merge requests', feature: true do describe 'filter by author id', js: true do it 'filter by current user' do - visit namespace_project_merge_requests_path(project.namespace, project, author_id: user.id) + visit project_merge_requests_path(project, author_id: user.id) expect_tokens([{ name: 'author', value: "@#{user.username}" }]) expect_filtered_search_input_empty @@ -326,7 +326,7 @@ describe 'Filter merge requests', feature: true do new_user = create(:user) project.add_developer(new_user) - visit namespace_project_merge_requests_path(project.namespace, project, author_id: new_user.id) + visit project_merge_requests_path(project, author_id: new_user.id) expect_tokens([{ name: 'author', value: "@#{new_user.username}" }]) expect_filtered_search_input_empty diff --git a/spec/features/merge_requests/form_spec.rb b/spec/features/merge_requests/form_spec.rb index 7a665e868d4..14148633451 100644 --- a/spec/features/merge_requests/form_spec.rb +++ b/spec/features/merge_requests/form_spec.rb @@ -23,10 +23,7 @@ describe 'New/edit merge request', feature: true, js: true do context 'new merge request' do before do - visit namespace_project_new_merge_request_path( - project.namespace, - project, - merge_request: { + visit project_new_merge_request_path(project, merge_request: { source_project_id: project.id, target_project_id: project.id, source_branch: 'fix', @@ -114,7 +111,7 @@ describe 'New/edit merge request', feature: true, js: true do target_branch: 'master' ) - visit edit_namespace_project_merge_request_path(project.namespace, project, merge_request) + visit edit_project_merge_request_path(project, merge_request) end it 'updates merge request' do @@ -182,10 +179,7 @@ describe 'New/edit merge request', feature: true, js: true do context 'new merge request' do before do - visit namespace_project_new_merge_request_path( - fork_project.namespace, - fork_project, - merge_request: { + visit project_new_merge_request_path(fork_project, merge_request: { source_project_id: fork_project.id, target_project_id: project.id, source_branch: 'fix', @@ -251,7 +245,7 @@ describe 'New/edit merge request', feature: true, js: true do target_branch: 'master' ) - visit edit_namespace_project_merge_request_path(project.namespace, project, merge_request) + visit edit_project_merge_request_path(project, merge_request) end it 'should update merge request' do diff --git a/spec/features/merge_requests/merge_commit_message_toggle_spec.rb b/spec/features/merge_requests/merge_commit_message_toggle_spec.rb index fbc5518b997..6cd62ecec72 100644 --- a/spec/features/merge_requests/merge_commit_message_toggle_spec.rb +++ b/spec/features/merge_requests/merge_commit_message_toggle_spec.rb @@ -36,7 +36,7 @@ feature 'Clicking toggle commit message link', feature: true, js: true do sign_in user - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) expect(page).not_to have_selector('.js-commit-message') click_button "Modify commit message" diff --git a/spec/features/merge_requests/merge_immediately_with_pipeline_spec.rb b/spec/features/merge_requests/merge_immediately_with_pipeline_spec.rb index 8f1c0b4f7af..d3475bee5cc 100644 --- a/spec/features/merge_requests/merge_immediately_with_pipeline_spec.rb +++ b/spec/features/merge_requests/merge_immediately_with_pipeline_spec.rb @@ -29,7 +29,7 @@ feature 'Merge immediately', :feature, :js do before do sign_in user - visit namespace_project_merge_request_path(merge_request.project.namespace, merge_request.project, merge_request) + visit project_merge_request_path(merge_request.project, merge_request) end it 'enables merge immediately' do diff --git a/spec/features/merge_requests/merge_when_pipeline_succeeds_spec.rb b/spec/features/merge_requests/merge_when_pipeline_succeeds_spec.rb index 60c3b30e55e..230b04296b3 100644 --- a/spec/features/merge_requests/merge_when_pipeline_succeeds_spec.rb +++ b/spec/features/merge_requests/merge_when_pipeline_succeeds_spec.rb @@ -155,6 +155,6 @@ feature 'Merge When Pipeline Succeeds', :feature, :js do end def visit_merge_request(merge_request) - visit namespace_project_merge_request_path(merge_request.project.namespace, merge_request.project, merge_request) + visit project_merge_request_path(merge_request.project, merge_request) end end diff --git a/spec/features/merge_requests/mini_pipeline_graph_spec.rb b/spec/features/merge_requests/mini_pipeline_graph_spec.rb index 1285961ca96..4adf72a60b0 100644 --- a/spec/features/merge_requests/mini_pipeline_graph_spec.rb +++ b/spec/features/merge_requests/mini_pipeline_graph_spec.rb @@ -16,7 +16,7 @@ feature 'Mini Pipeline Graph', :js, :feature do end def visit_merge_request(format = :html) - visit namespace_project_merge_request_path(project.namespace, project, merge_request, format: format) + visit project_merge_request_path(project, merge_request, format: format) end it 'should display a mini pipeline graph' do @@ -111,7 +111,7 @@ feature 'Mini Pipeline Graph', :js, :feature do build_item.click find('.build-page') - expect(current_path).to eql(namespace_project_job_path(project.namespace, project, build)) + expect(current_path).to eql(project_job_path(project, build)) end it 'should show tooltip when hovered' do diff --git a/spec/features/merge_requests/only_allow_merge_if_build_succeeds_spec.rb b/spec/features/merge_requests/only_allow_merge_if_build_succeeds_spec.rb index c1780541f43..651cb9d86fb 100644 --- a/spec/features/merge_requests/only_allow_merge_if_build_succeeds_spec.rb +++ b/spec/features/merge_requests/only_allow_merge_if_build_succeeds_spec.rb @@ -145,6 +145,6 @@ feature 'Only allow merge requests to be merged if the pipeline succeeds', featu end def visit_merge_request(merge_request) - visit namespace_project_merge_request_path(merge_request.project.namespace, merge_request.project, merge_request) + visit project_merge_request_path(merge_request.project, merge_request) end end diff --git a/spec/features/merge_requests/pipelines_spec.rb b/spec/features/merge_requests/pipelines_spec.rb index e4e1d60cff9..837366ced3c 100644 --- a/spec/features/merge_requests/pipelines_spec.rb +++ b/spec/features/merge_requests/pipelines_spec.rb @@ -19,7 +19,7 @@ feature 'Pipelines for Merge Requests', feature: true, js: true do end before do - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end scenario 'user visits merge request pipelines tab' do @@ -34,7 +34,7 @@ feature 'Pipelines for Merge Requests', feature: true, js: true do context 'without pipelines' do before do - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end scenario 'user visits merge request page' do diff --git a/spec/features/merge_requests/target_branch_spec.rb b/spec/features/merge_requests/target_branch_spec.rb index 33b954e6a25..3ed76926eab 100644 --- a/spec/features/merge_requests/target_branch_spec.rb +++ b/spec/features/merge_requests/target_branch_spec.rb @@ -6,10 +6,7 @@ describe 'Target branch', feature: true, js: true do let(:project) { merge_request.project } def path_to_merge_request - namespace_project_merge_request_path( - project.namespace, - project, merge_request - ) + project_merge_request_path(project, merge_request) end before do diff --git a/spec/features/merge_requests/toggle_whitespace_changes_spec.rb b/spec/features/merge_requests/toggle_whitespace_changes_spec.rb index b29eba5df88..912aa34b0c8 100644 --- a/spec/features/merge_requests/toggle_whitespace_changes_spec.rb +++ b/spec/features/merge_requests/toggle_whitespace_changes_spec.rb @@ -5,7 +5,7 @@ feature 'Toggle Whitespace Changes', js: true, feature: true do sign_in(create(:admin)) merge_request = create(:merge_request) project = merge_request.source_project - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request) + visit diffs_project_merge_request_path(project, merge_request) end it 'has a button to toggle whitespace changes' do diff --git a/spec/features/merge_requests/toggler_behavior_spec.rb b/spec/features/merge_requests/toggler_behavior_spec.rb index eb4ea3f3886..01251105f72 100644 --- a/spec/features/merge_requests/toggler_behavior_spec.rb +++ b/spec/features/merge_requests/toggler_behavior_spec.rb @@ -11,7 +11,7 @@ feature 'toggler_behavior', js: true, feature: true do sign_in(create(:admin)) project = merge_request.source_project page.current_window.resize_to(1000, 300) - visit "#{namespace_project_merge_request_path(project.namespace, project, merge_request)}#{fragment_id}" + visit "#{project_merge_request_path(project, merge_request)}#{fragment_id}" end describe 'scroll position' do diff --git a/spec/features/merge_requests/update_merge_requests_spec.rb b/spec/features/merge_requests/update_merge_requests_spec.rb index af9fda412af..43153e2cfa4 100644 --- a/spec/features/merge_requests/update_merge_requests_spec.rb +++ b/spec/features/merge_requests/update_merge_requests_spec.rb @@ -13,7 +13,7 @@ feature 'Multiple merge requests updating from merge_requests#index', feature: t context 'status', js: true do describe 'close merge request' do before do - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) end it 'closes merge request' do @@ -26,7 +26,7 @@ feature 'Multiple merge requests updating from merge_requests#index', feature: t describe 'reopen merge request' do before do merge_request.close - visit namespace_project_merge_requests_path(project.namespace, project, state: 'closed') + visit project_merge_requests_path(project, state: 'closed') end it 'reopens merge request' do @@ -40,7 +40,7 @@ feature 'Multiple merge requests updating from merge_requests#index', feature: t context 'assignee', js: true do describe 'set assignee' do before do - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) end it "updates merge request with assignee" do @@ -56,7 +56,7 @@ feature 'Multiple merge requests updating from merge_requests#index', feature: t before do merge_request.assignee = user merge_request.save - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) end it "removes assignee from the merge request" do @@ -72,7 +72,7 @@ feature 'Multiple merge requests updating from merge_requests#index', feature: t describe 'set milestone' do before do - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) end it "updates merge request with milestone" do @@ -86,7 +86,7 @@ feature 'Multiple merge requests updating from merge_requests#index', feature: t before do merge_request.milestone = milestone merge_request.save - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) end it "removes milestone from the merge request" do diff --git a/spec/features/merge_requests/user_lists_merge_requests_spec.rb b/spec/features/merge_requests/user_lists_merge_requests_spec.rb index cabb8e455f9..c50cfa78218 100644 --- a/spec/features/merge_requests/user_lists_merge_requests_spec.rb +++ b/spec/features/merge_requests/user_lists_merge_requests_spec.rb @@ -37,7 +37,7 @@ describe 'Projects > Merge requests > User lists merge requests', feature: true it 'filters on no assignee' do visit_merge_requests(project, assignee_id: IssuableFinder::NONE) - expect(current_path).to eq(namespace_project_merge_requests_path(project.namespace, project)) + expect(current_path).to eq(project_merge_requests_path(project)) expect(page).to have_content 'merge_lfs' expect(page).not_to have_content 'fix' expect(page).not_to have_content 'markdown' @@ -136,8 +136,7 @@ describe 'Projects > Merge requests > User lists merge requests', feature: true end it 'sorts by recently due milestone' do - visit namespace_project_merge_requests_path(project.namespace, project, - label_name: [label.name, label2.name], + visit project_merge_requests_path(project, label_name: [label.name, label2.name], assignee_id: user.id, sort: sort_value_milestone_soon) diff --git a/spec/features/merge_requests/user_posts_diff_notes_spec.rb b/spec/features/merge_requests/user_posts_diff_notes_spec.rb index 429aafe036a..1cfd78663e5 100644 --- a/spec/features/merge_requests/user_posts_diff_notes_spec.rb +++ b/spec/features/merge_requests/user_posts_diff_notes_spec.rb @@ -17,7 +17,7 @@ feature 'Merge requests > User posts diff notes', :js do context 'when hovering over a parallel view diff file' do before do - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, view: 'parallel') + visit diffs_project_merge_request_path(project, merge_request, view: 'parallel') end context 'with an old line on the left and no line on the right' do @@ -92,7 +92,7 @@ feature 'Merge requests > User posts diff notes', :js do context 'when hovering over an inline view diff file' do before do - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, view: 'inline') + visit diffs_project_merge_request_path(project, merge_request, view: 'inline') end context 'with a new line' do @@ -136,9 +136,9 @@ feature 'Merge requests > User posts diff notes', :js do context 'when hovering over a diff discussion' do before do - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, view: 'inline') + visit diffs_project_merge_request_path(project, merge_request, view: 'inline') should_allow_commenting(find('[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_7_7"]')) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'does not allow commenting' do @@ -149,7 +149,7 @@ feature 'Merge requests > User posts diff notes', :js do context 'when cancelling the comment addition' do before do - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, view: 'inline') + visit diffs_project_merge_request_path(project, merge_request, view: 'inline') end context 'with a new line' do @@ -161,7 +161,7 @@ feature 'Merge requests > User posts diff notes', :js do describe 'with muliple note forms' do before do - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, view: 'inline') + visit diffs_project_merge_request_path(project, merge_request, view: 'inline') click_diff_line(find('[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_9"]')) click_diff_line(find('[id="6eb14e00385d2fb284765eb1cd8d420d33d63fc9_22_22"]')) end @@ -181,7 +181,7 @@ feature 'Merge requests > User posts diff notes', :js do context 'when the MR only supports legacy diff notes' do before do merge_request.merge_request_diff.update_attributes(start_commit_sha: nil) - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, view: 'inline') + visit diffs_project_merge_request_path(project, merge_request, view: 'inline') end context 'with a new line' do diff --git a/spec/features/merge_requests/user_posts_notes_spec.rb b/spec/features/merge_requests/user_posts_notes_spec.rb index fa2d662bda3..35ed08e0a5e 100644 --- a/spec/features/merge_requests/user_posts_notes_spec.rb +++ b/spec/features/merge_requests/user_posts_notes_spec.rb @@ -14,7 +14,7 @@ describe 'Merge requests > User posts notes', :js do before do sign_in(create(:admin)) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end subject { page } diff --git a/spec/features/merge_requests/user_sees_system_notes_spec.rb b/spec/features/merge_requests/user_sees_system_notes_spec.rb index 04919cde939..624a425ae52 100644 --- a/spec/features/merge_requests/user_sees_system_notes_spec.rb +++ b/spec/features/merge_requests/user_sees_system_notes_spec.rb @@ -15,7 +15,7 @@ feature 'Merge requests > User sees system notes' do end it 'shows the system note' do - visit namespace_project_merge_request_path(public_project.namespace, public_project, merge_request) + visit project_merge_request_path(public_project, merge_request) expect(page).to have_css('.system-note') end @@ -23,7 +23,7 @@ feature 'Merge requests > User sees system notes' do context 'when not logged-in' do it 'hides the system note' do - visit namespace_project_merge_request_path(public_project.namespace, public_project, merge_request) + visit project_merge_request_path(public_project, merge_request) expect(page).not_to have_css('.system-note') end diff --git a/spec/features/merge_requests/user_uses_slash_commands_spec.rb b/spec/features/merge_requests/user_uses_slash_commands_spec.rb index 92bbd56cee9..434f5a7c0ac 100644 --- a/spec/features/merge_requests/user_uses_slash_commands_spec.rb +++ b/spec/features/merge_requests/user_uses_slash_commands_spec.rb @@ -17,7 +17,7 @@ feature 'Merge Requests > User uses quick actions', feature: true, js: true do before do project.team << [user, :master] sign_in(user) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end after do @@ -53,7 +53,7 @@ feature 'Merge Requests > User uses quick actions', feature: true, js: true do project.team << [guest, :guest] sign_out(:user) sign_in(guest) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'does not change the WIP prefix' do @@ -99,7 +99,7 @@ feature 'Merge Requests > User uses quick actions', feature: true, js: true do project.team << [guest, :guest] sign_out(:user) sign_in(guest) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'does not merge the MR' do @@ -131,7 +131,7 @@ feature 'Merge Requests > User uses quick actions', feature: true, js: true do end it 'changes target_branch in new merge_request' do - visit namespace_project_new_merge_request_path(another_project.namespace, another_project, new_url_opts) + visit project_new_merge_request_path(another_project, new_url_opts) fill_in "merge_request_title", with: 'My brand new feature' fill_in "merge_request_description", with: "le feature \n/target_branch fix\nFeature description:" @@ -145,7 +145,7 @@ feature 'Merge Requests > User uses quick actions', feature: true, js: true do it 'does not change target branch when merge request is edited' do new_merge_request = create(:merge_request, source_project: another_project) - visit edit_namespace_project_merge_request_path(another_project.namespace, another_project, new_merge_request) + visit edit_project_merge_request_path(another_project, new_merge_request) fill_in "merge_request_description", with: "Want to update target branch\n/target_branch fix\n" click_button "Save changes" @@ -183,7 +183,7 @@ feature 'Merge Requests > User uses quick actions', feature: true, js: true do project.team << [guest, :guest] sign_out(:user) sign_in(guest) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'does not change target branch' do diff --git a/spec/features/merge_requests/versions_spec.rb b/spec/features/merge_requests/versions_spec.rb index 5c41c859e2e..f6f2c46758f 100644 --- a/spec/features/merge_requests/versions_spec.rb +++ b/spec/features/merge_requests/versions_spec.rb @@ -9,7 +9,7 @@ feature 'Merge Request versions', js: true, feature: true do before do sign_in(create(:admin)) - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request) + visit diffs_project_merge_request_path(project, merge_request) end it 'show the latest version of the diff' do @@ -96,13 +96,8 @@ feature 'Merge Request versions', js: true, feature: true do end it 'has a path with comparison context' do - expect(page).to have_current_path diffs_namespace_project_merge_request_path( - project.namespace, - project, - merge_request.iid, - diff_id: merge_request_diff3.id, - start_sha: '6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9' - ) + expect(page).to have_current_path diffs_project_merge_request_path(project, merge_request.iid, diff_id: merge_request_diff3.id, + start_sha: '6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9') end it 'should have correct value in the compare dropdown' do diff --git a/spec/features/merge_requests/widget_deployments_spec.rb b/spec/features/merge_requests/widget_deployments_spec.rb index 68a5b4dea0e..b0fe5f3e1cb 100644 --- a/spec/features/merge_requests/widget_deployments_spec.rb +++ b/spec/features/merge_requests/widget_deployments_spec.rb @@ -14,7 +14,7 @@ feature 'Widget Deployments Header', feature: true, js: true do background do sign_in(user) project.team << [user, role] - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end scenario 'displays that the environment is deployed' do diff --git a/spec/features/merge_requests/widget_spec.rb b/spec/features/merge_requests/widget_spec.rb index 9f3d47e52c5..3dcb0ea64de 100644 --- a/spec/features/merge_requests/widget_spec.rb +++ b/spec/features/merge_requests/widget_spec.rb @@ -12,16 +12,12 @@ describe 'Merge request', :feature, :js do context 'new merge request' do before do - visit namespace_project_new_merge_request_path( - project.namespace, - project, - merge_request: { + visit project_new_merge_request_path(project, merge_request: { source_project_id: project.id, target_project_id: project.id, source_branch: 'feature', target_branch: 'master' - } - ) + }) end it 'shows widget status after creating new merge request' do @@ -44,7 +40,7 @@ describe 'Merge request', :feature, :js do end before do - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'shows environments link' do @@ -71,7 +67,7 @@ describe 'Merge request', :feature, :js do type: 'CiService', category: 'ci') - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'has danger button while waiting for external CI status' do @@ -92,7 +88,7 @@ describe 'Merge request', :feature, :js do head_pipeline_of: merge_request) create(:ci_build, :pending, pipeline: pipeline) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'has danger button when not succeeded' do @@ -112,9 +108,7 @@ describe 'Merge request', :feature, :js do status: :manual, head_pipeline_of: merge_request) - visit namespace_project_merge_request_path(project.namespace, - project, - merge_request) + visit project_merge_request_path(project, merge_request) end it 'shows information about blocked pipeline' do @@ -136,7 +130,7 @@ describe 'Merge request', :feature, :js do head_pipeline_of: merge_request) create(:ci_build, :pending, pipeline: pipeline) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'has info button when MWBS button' do @@ -154,7 +148,7 @@ describe 'Merge request', :feature, :js do merge_error: 'Something went wrong' ) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'shows information about the merge error' do @@ -175,7 +169,7 @@ describe 'Merge request', :feature, :js do merge_error: 'Something went wrong' ) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'shows information about the merge error' do @@ -191,7 +185,7 @@ describe 'Merge request', :feature, :js do context 'merge error' do before do allow_any_instance_of(Repository).to receive(:merge).and_return(false) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'updates the MR widget' do @@ -212,7 +206,7 @@ describe 'Merge request', :feature, :js do sign_out(:user) sign_in(user2) merge_request.update(target_project: fork_project) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'user can merge into the source project' do diff --git a/spec/features/merge_requests/wip_message_spec.rb b/spec/features/merge_requests/wip_message_spec.rb index 51df08a1728..f555306d6a3 100644 --- a/spec/features/merge_requests/wip_message_spec.rb +++ b/spec/features/merge_requests/wip_message_spec.rb @@ -11,16 +11,12 @@ feature 'Work In Progress help message', feature: true do context 'with WIP commits' do it 'shows a specific WIP hint' do - visit namespace_project_new_merge_request_path( - project.namespace, - project, - merge_request: { + visit project_new_merge_request_path(project, merge_request: { source_project_id: project.id, target_project_id: project.id, source_branch: 'wip', target_branch: 'master' - } - ) + }) within_wip_explanation do expect(page).to have_text( @@ -32,16 +28,12 @@ feature 'Work In Progress help message', feature: true do context 'without WIP commits' do it 'shows the regular WIP message' do - visit namespace_project_new_merge_request_path( - project.namespace, - project, - merge_request: { + visit project_new_merge_request_path(project, merge_request: { source_project_id: project.id, target_project_id: project.id, source_branch: 'fix', target_branch: 'master' - } - ) + }) within_wip_explanation do expect(page).not_to have_text( |