Commit 9eeba8fb authored by Robert Speicher's avatar Robert Speicher

Auto-correct ProjectPathHelper violations

parent ea2a91a3
......@@ -51,7 +51,7 @@ feature 'Admin disables Git access protocol', feature: true do
end
def visit_project
visit namespace_project_path(project.namespace, project)
visit project_path(project)
end
def disable_http_protocol
......
......@@ -44,7 +44,7 @@ describe "Admin::Projects", feature: true do
end
it do
expect(current_path).to eq admin_namespace_project_path(project.namespace, project)
expect(current_path).to eq admin_project_path(project)
end
it "has project info" do
......@@ -64,7 +64,7 @@ describe "Admin::Projects", feature: true do
end
it 'transfers project to group web', js: true do
visit admin_namespace_project_path(project.namespace, project)
visit admin_project_path(project)
click_button 'Search for Namespace'
click_link 'group: web'
......@@ -81,7 +81,7 @@ describe "Admin::Projects", feature: true do
end
it 'adds admin a to a project as developer', js: true do
visit namespace_project_project_members_path(project.namespace, project)
visit project_project_members_path(project)
page.within '.users-project-form' do
select2(current_user.id, from: '#user_ids', multiple: true)
......@@ -104,7 +104,7 @@ describe "Admin::Projects", feature: true do
end
it 'removes admin from the project' do
visit namespace_project_project_members_path(project.namespace, project)
visit project_project_members_path(project)
page.within '.content-list' do
expect(page).to have_content(current_user.name)
......
......@@ -43,6 +43,6 @@ feature 'Admin uses repository checks', feature: true do
end
def visit_admin_project_page(project)
visit admin_namespace_project_path(project.namespace, project)
visit admin_project_path(project)
end
end
......@@ -16,7 +16,7 @@ describe 'Issues Feed', feature: true do
context 'when authenticated' do
it 'renders atom feed' do
sign_in user
visit namespace_project_issues_path(project.namespace, project, :atom)
visit project_issues_path(project, :atom)
expect(response_headers['Content-Type'])
.to have_content('application/atom+xml')
......@@ -30,8 +30,7 @@ describe 'Issues Feed', feature: true do
context 'when authenticated via private token' do
it 'renders atom feed' do
visit namespace_project_issues_path(project.namespace, project, :atom,
private_token: user.private_token)
visit project_issues_path(project, :atom, private_token: user.private_token)
expect(response_headers['Content-Type'])
.to have_content('application/atom+xml')
......@@ -45,8 +44,7 @@ describe 'Issues Feed', feature: true do
context 'when authenticated via RSS token' do
it 'renders atom feed' do
visit namespace_project_issues_path(project.namespace, project, :atom,
rss_token: user.rss_token)
visit project_issues_path(project, :atom, rss_token: user.rss_token)
expect(response_headers['Content-Type'])
.to have_content('application/atom+xml')
......@@ -59,8 +57,7 @@ describe 'Issues Feed', feature: true do
end
it "renders atom feed with url parameters for project issues" do
visit namespace_project_issues_path(project.namespace, project,
:atom, rss_token: user.rss_token, state: 'opened', assignee_id: user.id)
visit project_issues_path(project, :atom, rss_token: user.rss_token, state: 'opened', assignee_id: user.id)
link = find('link[type="application/atom+xml"]')
params = CGI.parse(URI.parse(link[:href]).query)
......
......@@ -16,7 +16,7 @@ describe 'Auto deploy' do
end
it 'does not show a button to set up auto deploy' do
visit namespace_project_path(project.namespace, project)
visit project_path(project)
expect(page).to have_no_content('Set up auto deploy')
end
end
......@@ -24,7 +24,7 @@ describe 'Auto deploy' do
context 'when a deployment service is active' do
before do
project.kubernetes_service.update!(active: true)
visit namespace_project_path(project.namespace, project)
visit project_path(project)
end
it 'shows a button to set up auto deploy' do
......
......@@ -16,12 +16,12 @@ describe 'Issue Boards add issue modal', :feature, :js do
sign_in(user)
visit namespace_project_board_path(project.namespace, project, board)
visit project_board_path(project, board)
wait_for_requests
end
it 'resets filtered search state' do
visit namespace_project_board_path(project.namespace, project, board, search: 'testing')
visit project_board_path(project, board, search: 'testing')
wait_for_requests
......
......@@ -17,7 +17,7 @@ describe 'Issue Boards', feature: true, js: true do
context 'no lists' do
before do
visit namespace_project_board_path(project.namespace, project, board)
visit project_board_path(project, board)
wait_for_requests
expect(page).to have_selector('.board', count: 3)
end
......@@ -81,7 +81,7 @@ describe 'Issue Boards', feature: true, js: true do
let!(:issue9) { create(:labeled_issue, project: project, labels: [planning, testing, bug, accepting], relative_position: 1) }
before do
visit namespace_project_board_path(project.namespace, project, board)
visit project_board_path(project, board)
wait_for_requests
......@@ -158,7 +158,7 @@ describe 'Issue Boards', feature: true, js: true do
create(:labeled_issue, project: project, labels: [planning])
end
visit namespace_project_board_path(project.namespace, project, board)
visit project_board_path(project, board)
wait_for_requests
page.within(find('.board:nth-child(2)')) do
......@@ -507,7 +507,7 @@ describe 'Issue Boards', feature: true, js: true do
context 'keyboard shortcuts' do
before do
visit namespace_project_board_path(project.namespace, project, board)
visit project_board_path(project, board)
wait_for_requests
end
......@@ -520,7 +520,7 @@ describe 'Issue Boards', feature: true, js: true do
context 'signed out user' do
before do
sign_out(:user)
visit namespace_project_board_path(project.namespace, project, board)
visit project_board_path(project, board)
wait_for_requests
end
......@@ -544,7 +544,7 @@ describe 'Issue Boards', feature: true, js: true do
project.team << [user_guest, :guest]
sign_out(:user)
sign_in(user_guest)
visit namespace_project_board_path(project.namespace, project, board)
visit project_board_path(project, board)
wait_for_requests
end
......
......@@ -22,7 +22,7 @@ describe 'Issue Boards', :feature, :js do
let!(:issue4) { create(:labeled_issue, project: project, labels: [label]) }
before do
visit namespace_project_board_path(project.namespace, project, board)
visit project_board_path(project, board)
wait_for_requests
expect(page).to have_selector('.board', count: 3)
......@@ -47,7 +47,7 @@ describe 'Issue Boards', :feature, :js do
context 'ordering in list' do
before do
visit namespace_project_board_path(project.namespace, project, board)
visit project_board_path(project, board)
wait_for_requests
expect(page).to have_selector('.board', count: 3)
......@@ -110,7 +110,7 @@ describe 'Issue Boards', :feature, :js do
let!(:issue6) { create(:labeled_issue, project: project, title: 'testing 3', labels: [label2], relative_position: 1.0) }
before do
visit namespace_project_board_path(project.namespace, project, board)
visit project_board_path(project, board)
wait_for_requests
expect(page).to have_selector('.board', count: 4)
......
......@@ -8,7 +8,7 @@ describe 'Issue Boards shortcut', feature: true, js: true do
sign_in(create(:admin))
visit namespace_project_path(project.namespace, project)
visit project_path(project)
end
it 'takes user to issue board index' do
......
......@@ -202,7 +202,7 @@ describe 'Issue Boards add issue modal filtering', :feature, :js do
end
def visit_board
visit namespace_project_board_path(project.namespace, project, board)
visit project_board_path(project, board)
wait_for_requests
click_button('Add issues')
......
......@@ -12,7 +12,7 @@ describe 'Issue Boards new issue', feature: true, js: true do
sign_in(user)
visit namespace_project_board_path(project.namespace, project, board)
visit project_board_path(project, board)
wait_for_requests
expect(page).to have_selector('.board', count: 3)
......@@ -83,7 +83,7 @@ describe 'Issue Boards new issue', feature: true, js: true do
context 'unauthorized user' do
before do
visit namespace_project_board_path(project.namespace, project, board)
visit project_board_path(project, board)
wait_for_requests
end
......
......@@ -22,7 +22,7 @@ describe 'Issue Boards', feature: true, js: true do
sign_in(user)
visit namespace_project_board_path(project.namespace, project, board)
visit project_board_path(project, board)
wait_for_requests
end
......
......@@ -15,7 +15,7 @@ describe 'Sub-group project issue boards', :feature, :js do
sign_in(user)
visit namespace_project_board_path(project.namespace, project, board)
visit project_board_path(project, board)
wait_for_requests
end
......
......@@ -66,7 +66,7 @@ describe 'Commits' do
end
before do
visit namespace_project_commits_path(project.namespace, project, :master)
visit project_commits_path(project, :master)
end
it 'shows correct build status from default branch' do
......@@ -192,7 +192,7 @@ describe 'Commits' do
before do
project.team << [user, :master]
sign_in(user)
visit namespace_project_commits_path(project.namespace, project, branch_name)
visit project_commits_path(project, branch_name)
end
it 'includes the committed_date for each commit' do
......
......@@ -55,7 +55,6 @@ describe "Container Registry" do
end
def visit_container_registry
visit namespace_project_container_registry_index_path(
project.namespace, project)
visit project_container_registry_index_path(project)
end
end
......@@ -16,7 +16,7 @@ describe 'Copy as GFM', feature: true, js: true do
# `markdown` helper expects a `@project` variable
@project = @feat.project
visit namespace_project_issue_path(@project.namespace, @project, @feat.issue)
visit project_issue_path(@project, @feat.issue)
end
# The filters referenced in lib/banzai/pipeline/gfm_pipeline.rb convert GitLab Flavored Markdown (GFM) to HTML.
......@@ -121,13 +121,13 @@ describe 'Copy as GFM', feature: true, js: true do
# full issue reference
@feat.issue.to_reference(full: true),
# issue URL
namespace_project_issue_url(@project.namespace, @project, @feat.issue),
project_issue_url(@project, @feat.issue),
# issue URL with note anchor
namespace_project_issue_url(@project.namespace, @project, @feat.issue, anchor: 'note_123'),
project_issue_url(@project, @feat.issue, anchor: 'note_123'),
# issue link
"[Issue](#{namespace_project_issue_url(@project.namespace, @project, @feat.issue)})",
"[Issue](#{project_issue_url(@project, @feat.issue)})",
# issue link with note anchor
"[Issue](#{namespace_project_issue_url(@project.namespace, @project, @feat.issue, anchor: 'note_123')})"
"[Issue](#{project_issue_url(@project, @feat.issue, anchor: 'note_123')})"
)
verify(
......@@ -466,7 +466,7 @@ describe 'Copy as GFM', feature: true, js: true do
context 'from a diff' do
before do
visit namespace_project_commit_path(project.namespace, project, sample_commit.id)
visit project_commit_path(project, sample_commit.id)
end
context 'selecting one word of text' do
......@@ -507,7 +507,7 @@ describe 'Copy as GFM', feature: true, js: true do
context 'from a blob' do
before do
visit namespace_project_blob_path(project.namespace, project, File.join('master', 'files/ruby/popen.rb'))
visit project_blob_path(project, File.join('master', 'files/ruby/popen.rb'))
wait_for_requests
end
......@@ -549,7 +549,7 @@ describe 'Copy as GFM', feature: true, js: true do
context 'from a GFM code block' do
before do
visit namespace_project_blob_path(project.namespace, project, File.join('markdown', 'doc/api/users.md'))
visit project_blob_path(project, File.join('markdown', 'doc/api/users.md'))
wait_for_requests
end
......
......@@ -16,7 +16,7 @@ feature 'Cycle Analytics', feature: true, js: true do
sign_in(user)
visit namespace_project_cycle_analytics_path(project.namespace, project)
visit project_cycle_analytics_path(project)
wait_for_requests
end
......@@ -39,7 +39,7 @@ feature 'Cycle Analytics', feature: true, js: true do
deploy_master
sign_in(user)
visit namespace_project_cycle_analytics_path(project.namespace, project)
visit project_cycle_analytics_path(project)
end
it 'shows data on each stage' do
......@@ -71,7 +71,7 @@ feature 'Cycle Analytics', feature: true, js: true do
project.team << [user, :master]
sign_in(user)
visit namespace_project_cycle_analytics_path(project.namespace, project)
visit project_cycle_analytics_path(project)
wait_for_requests
end
......@@ -94,7 +94,7 @@ feature 'Cycle Analytics', feature: true, js: true do
deploy_master
sign_in(guest)
visit namespace_project_cycle_analytics_path(project.namespace, project)
visit project_cycle_analytics_path(project)
wait_for_requests
end
......
......@@ -10,7 +10,7 @@ feature 'Project member activity', feature: true, js: true do
def visit_activities_and_wait_with_event(event_type)
Event.create(project: project, author_id: user.id, action: event_type)
visit activity_namespace_project_path(project.namespace, project)
visit activity_project_path(project)
wait_for_requests
end
......
......@@ -66,7 +66,7 @@ RSpec.describe 'Dashboard Projects', feature: true do
it 'shows that the last pipeline passed' do
visit dashboard_projects_path
expect(page).to have_xpath("//a[@href='#{pipelines_namespace_project_commit_path(project.namespace, project, project.commit)}']")
expect(page).to have_xpath("//a[@href='#{pipelines_project_commit_path(project, project.commit)}']")
end
end
end
......@@ -330,7 +330,7 @@ feature 'Dashboard Todos' do
end
it 'links to the pipelines for the merge request' do
href = pipelines_namespace_project_merge_request_path(project.namespace, project, todo.target)
href = pipelines_project_merge_request_path(project, todo.target)
expect(page).to have_link "merge request #{todo.target.to_reference(full: true)}", href
end
......
......@@ -11,7 +11,7 @@ describe 'Discussion Comments Merge Request', :feature, :js do
project.add_master(user)
sign_in(user)
visit namespace_project_commit_path(project.namespace, project, sample_commit.id)
visit project_commit_path(project, sample_commit.id)
end
it_behaves_like 'discussion comments', 'commit'
......
......@@ -9,7 +9,7 @@ describe 'Discussion Comments Issue', :feature, :js do
project.add_master(user)
sign_in(user)
visit namespace_project_issue_path(project.namespace, project, issue)
visit project_issue_path(project, issue)
end
it_behaves_like 'discussion comments', 'issue'
......
......@@ -9,7 +9,7 @@ describe 'Discussion Comments Merge Request', :feature, :js do
project.add_master(user)
sign_in(user)
visit namespace_project_merge_request_path(project.namespace, project, merge_request)
visit project_merge_request_path(project, merge_request)
end
it_behaves_like 'discussion comments', 'merge request'
......
......@@ -9,7 +9,7 @@ describe 'Discussion Comments Issue', :feature, :js do
project.add_master(user)
sign_in(user)
visit namespace_project_snippet_path(project.namespace, project, snippet)
visit project_snippet_path(project, snippet)
end
it_behaves_like 'discussion comments', 'snippet'
......
......@@ -14,7 +14,7 @@ feature 'Expand and collapse diffs', js: true, feature: true do
# Ensure that undiffable.md is in .gitattributes
project.repository.copy_gitattributes(branch)
visit namespace_project_commit_path(project.namespace, project, project.commit(branch))
visit project_commit_path(project, project.commit(branch))
execute_script('window.ajaxUris = []; $(document).ajaxSend(function(event, xhr, settings) { ajaxUris.push(settings.url) });')
end
......@@ -38,7 +38,7 @@ feature 'Expand and collapse diffs', js: true, feature: true do
expect(large_diff).not_to have_selector('.code')
expect(large_diff).to have_selector('.nothing-here-block')
visit namespace_project_commit_path(project.namespace, project, project.commit(branch), anchor: "#{large_diff[:id]}_0_1")
visit project_commit_path(project, project.commit(branch), anchor: "#{large_diff[:id]}_0_1")
execute_script('window.location.reload()')
wait_for_requests
......@@ -52,7 +52,7 @@ feature 'Expand and collapse diffs', js: true, feature: true do
expect(large_diff).not_to have_selector('.code')
expect(large_diff).to have_selector('.nothing-here-block')
visit namespace_project_commit_path(project.namespace, project, project.commit(branch), anchor: large_diff[:id])
visit project_commit_path(project, project.commit(branch), anchor: large_diff[:id])
execute_script('window.location.reload()')
wait_for_requests
......
......@@ -47,7 +47,7 @@ feature 'Top Plus Menu', feature: true, js: true do
end
scenario 'click on New issue shows new issue page' do
visit namespace_project_path(project.namespace, project)
visit project_path(project)
click_topmenuitem("New issue")
......@@ -56,7 +56,7 @@ feature 'Top Plus Menu', feature: true, js: true do
end
scenario 'click on New merge request shows new merge request page' do
visit namespace_project_path(project.namespace, project)
visit project_path(project)
click_topmenuitem("New merge request")
......@@ -66,7 +66,7 @@ feature 'Top Plus Menu', feature: true, js: true do
end
scenario 'click on New project snippet shows new snippet page' do
visit namespace_project_path(project.namespace, project)
visit project_path(project)
page.within '.header-content' do
find('.header-new-dropdown-toggle').trigger('click')
......@@ -107,7 +107,7 @@ feature 'Top Plus Menu', feature: true, js: true do
end
scenario 'click on New issue shows new issue page' do
visit namespace_project_path(project.namespace, project)
visit project_path(project)
click_topmenuitem("New issue")
......@@ -116,31 +116,31 @@ feature 'Top Plus Menu', feature: true, js: true do
end
scenario 'has no New merge request menu item' do
visit namespace_project_path(project.namespace, project)
visit project_path(project)
hasnot_topmenuitem("New merge request")
end
scenario 'has no New project snippet menu item' do
visit namespace_project_path(project.namespace, project)
visit project_path(project)
expect(find('.header-new.dropdown')).not_to have_selector('.header-new-project-snippet')
end
scenario 'public project has no New Issue Button' do
visit namespace_project_path(public_project.namespace, public_project)
visit project_path(public_project)
hasnot_topmenuitem("New issue")
end
scenario 'public project has no New merge request menu item' do
visit namespace_project_path(public_project.namespace, public_project)
visit project_path(public_project)
hasnot_topmenuitem("New merge request")
end
scenario 'public project has no New project snippet menu item' do
visit namespace_project_path(public_project.namespace, public_project)
visit project_path(public_project)
expect(find('.header-new.dropdown')).not_to have_selector('.header-new-project-snippet')
end
......
......@@ -25,25 +25,25 @@ describe "GitLab Flavored Markdown", feature: true do
end
it "renders title in commits#index" do
visit namespace_project_commits_path(project.namespace, project, 'master', limit: 1)
visit project_commits_path(project, 'master', limit: 1)
expect(page).to have_link(issue.to_reference)
end
it "renders title in commits#show" do
visit namespace_project_commit_path(project.namespace, project, commit)
visit project_commit_path(project, commit)
expect(page).to have_link(issue.to_reference)
end
it "renders description in commits#show" do
visit namespace_project_commit_path(project.namespace, project, commit)
visit project_commit_path(project, commit)
expect(page).to have_link(fred.to_reference)
end
it "renders title in repositories#branches" do
visit namespace_project_branches_path(project.namespace, project)
visit project_branches_path(project)
expect(page).to have_link(issue.to_reference)
end
......@@ -66,19 +66,19 @@ describe "GitLab Flavored Markdown", feature: true do
end
it "renders subject in issues#index" do
visit namespace_project_issues_path(project.namespace, project)
visit project_issues_path(project)
expect(page).to have_link(@other_issue.to_reference)
end
it "renders subject in issues#show" do
visit namespace_project_issue_path(project.namespace, project, @issue)
visit project_issue_path(project, @issue)
expect(page).to have_link(@other_issue.to_reference)
end
it "renders details in issues#show" do
visit namespace_project_issue_path(project.namespace, project, @issue)
visit project_issue_path(project, @issue)
expect(page).to have_link(fred.to_reference)
end
......@@ -92,13 +92,13 @@ describe "GitLab Flavored Markdown", feature: true do
end
it "renders title in merge_requests#index" do
visit namespace_project_merge_requests_path(project.namespace, project)
visit project_merge_requests_path(project)
expect(page).to have_link(issue.to_reference)