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 ...@@ -51,7 +51,7 @@ feature 'Admin disables Git access protocol', feature: true do
end end
def visit_project def visit_project
visit namespace_project_path(project.namespace, project) visit project_path(project)
end end
def disable_http_protocol def disable_http_protocol
......
...@@ -44,7 +44,7 @@ describe "Admin::Projects", feature: true do ...@@ -44,7 +44,7 @@ describe "Admin::Projects", feature: true do
end end
it do it do
expect(current_path).to eq admin_namespace_project_path(project.namespace, project) expect(current_path).to eq admin_project_path(project)
end end
it "has project info" do it "has project info" do
...@@ -64,7 +64,7 @@ describe "Admin::Projects", feature: true do ...@@ -64,7 +64,7 @@ describe "Admin::Projects", feature: true do
end end
it 'transfers project to group web', js: true do 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_button 'Search for Namespace'
click_link 'group: web' click_link 'group: web'
...@@ -81,7 +81,7 @@ describe "Admin::Projects", feature: true do ...@@ -81,7 +81,7 @@ describe "Admin::Projects", feature: true do
end end
it 'adds admin a to a project as developer', js: true do 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 page.within '.users-project-form' do
select2(current_user.id, from: '#user_ids', multiple: true) select2(current_user.id, from: '#user_ids', multiple: true)
...@@ -104,7 +104,7 @@ describe "Admin::Projects", feature: true do ...@@ -104,7 +104,7 @@ describe "Admin::Projects", feature: true do
end end
it 'removes admin from the project' do 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 page.within '.content-list' do
expect(page).to have_content(current_user.name) expect(page).to have_content(current_user.name)
......
...@@ -43,6 +43,6 @@ feature 'Admin uses repository checks', feature: true do ...@@ -43,6 +43,6 @@ feature 'Admin uses repository checks', feature: true do
end end
def visit_admin_project_page(project) def visit_admin_project_page(project)
visit admin_namespace_project_path(project.namespace, project) visit admin_project_path(project)
end end
end end
...@@ -16,7 +16,7 @@ describe 'Issues Feed', feature: true do ...@@ -16,7 +16,7 @@ describe 'Issues Feed', feature: true do
context 'when authenticated' do context 'when authenticated' do
it 'renders atom feed' do it 'renders atom feed' do
sign_in user sign_in user
visit namespace_project_issues_path(project.namespace, project, :atom) visit project_issues_path(project, :atom)
expect(response_headers['Content-Type']) expect(response_headers['Content-Type'])
.to have_content('application/atom+xml') .to have_content('application/atom+xml')
...@@ -30,8 +30,7 @@ describe 'Issues Feed', feature: true do ...@@ -30,8 +30,7 @@ describe 'Issues Feed', feature: true do
context 'when authenticated via private token' do context 'when authenticated via private token' do
it 'renders atom feed' do it 'renders atom feed' do
visit namespace_project_issues_path(project.namespace, project, :atom, visit project_issues_path(project, :atom, private_token: user.private_token)
private_token: user.private_token)
expect(response_headers['Content-Type']) expect(response_headers['Content-Type'])
.to have_content('application/atom+xml') .to have_content('application/atom+xml')
...@@ -45,8 +44,7 @@ describe 'Issues Feed', feature: true do ...@@ -45,8 +44,7 @@ describe 'Issues Feed', feature: true do
context 'when authenticated via RSS token' do context 'when authenticated via RSS token' do
it 'renders atom feed' do it 'renders atom feed' do
visit namespace_project_issues_path(project.namespace, project, :atom, visit project_issues_path(project, :atom, rss_token: user.rss_token)
rss_token: user.rss_token)
expect(response_headers['Content-Type']) expect(response_headers['Content-Type'])
.to have_content('application/atom+xml') .to have_content('application/atom+xml')
...@@ -59,8 +57,7 @@ describe 'Issues Feed', feature: true do ...@@ -59,8 +57,7 @@ describe 'Issues Feed', feature: true do
end end
it "renders atom feed with url parameters for project issues" do it "renders atom feed with url parameters for project issues" do
visit namespace_project_issues_path(project.namespace, project, visit project_issues_path(project, :atom, rss_token: user.rss_token, state: 'opened', assignee_id: user.id)
:atom, rss_token: user.rss_token, state: 'opened', assignee_id: user.id)
link = find('link[type="application/atom+xml"]') link = find('link[type="application/atom+xml"]')
params = CGI.parse(URI.parse(link[:href]).query) params = CGI.parse(URI.parse(link[:href]).query)
......
...@@ -16,7 +16,7 @@ describe 'Auto deploy' do ...@@ -16,7 +16,7 @@ describe 'Auto deploy' do
end end
it 'does not show a button to set up auto deploy' do 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') expect(page).to have_no_content('Set up auto deploy')
end end
end end
...@@ -24,7 +24,7 @@ describe 'Auto deploy' do ...@@ -24,7 +24,7 @@ describe 'Auto deploy' do
context 'when a deployment service is active' do context 'when a deployment service is active' do
before do before do
project.kubernetes_service.update!(active: true) project.kubernetes_service.update!(active: true)
visit namespace_project_path(project.namespace, project) visit project_path(project)
end end
it 'shows a button to set up auto deploy' do it 'shows a button to set up auto deploy' do
......
...@@ -16,12 +16,12 @@ describe 'Issue Boards add issue modal', :feature, :js do ...@@ -16,12 +16,12 @@ describe 'Issue Boards add issue modal', :feature, :js do
sign_in(user) sign_in(user)
visit namespace_project_board_path(project.namespace, project, board) visit project_board_path(project, board)
wait_for_requests wait_for_requests
end end
it 'resets filtered search state' do 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 wait_for_requests
......
...@@ -17,7 +17,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -17,7 +17,7 @@ describe 'Issue Boards', feature: true, js: true do
context 'no lists' do context 'no lists' do
before do before do
visit namespace_project_board_path(project.namespace, project, board) visit project_board_path(project, board)
wait_for_requests wait_for_requests
expect(page).to have_selector('.board', count: 3) expect(page).to have_selector('.board', count: 3)
end end
...@@ -81,7 +81,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -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) } let!(:issue9) { create(:labeled_issue, project: project, labels: [planning, testing, bug, accepting], relative_position: 1) }
before do before do
visit namespace_project_board_path(project.namespace, project, board) visit project_board_path(project, board)
wait_for_requests wait_for_requests
...@@ -158,7 +158,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -158,7 +158,7 @@ describe 'Issue Boards', feature: true, js: true do
create(:labeled_issue, project: project, labels: [planning]) create(:labeled_issue, project: project, labels: [planning])
end end
visit namespace_project_board_path(project.namespace, project, board) visit project_board_path(project, board)
wait_for_requests wait_for_requests
page.within(find('.board:nth-child(2)')) do page.within(find('.board:nth-child(2)')) do
...@@ -507,7 +507,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -507,7 +507,7 @@ describe 'Issue Boards', feature: true, js: true do
context 'keyboard shortcuts' do context 'keyboard shortcuts' do
before do before do
visit namespace_project_board_path(project.namespace, project, board) visit project_board_path(project, board)
wait_for_requests wait_for_requests
end end
...@@ -520,7 +520,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -520,7 +520,7 @@ describe 'Issue Boards', feature: true, js: true do
context 'signed out user' do context 'signed out user' do
before do before do
sign_out(:user) sign_out(:user)
visit namespace_project_board_path(project.namespace, project, board) visit project_board_path(project, board)
wait_for_requests wait_for_requests
end end
...@@ -544,7 +544,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -544,7 +544,7 @@ describe 'Issue Boards', feature: true, js: true do
project.team << [user_guest, :guest] project.team << [user_guest, :guest]
sign_out(:user) sign_out(:user)
sign_in(user_guest) sign_in(user_guest)
visit namespace_project_board_path(project.namespace, project, board) visit project_board_path(project, board)
wait_for_requests wait_for_requests
end end
......
...@@ -22,7 +22,7 @@ describe 'Issue Boards', :feature, :js do ...@@ -22,7 +22,7 @@ describe 'Issue Boards', :feature, :js do
let!(:issue4) { create(:labeled_issue, project: project, labels: [label]) } let!(:issue4) { create(:labeled_issue, project: project, labels: [label]) }
before do before do
visit namespace_project_board_path(project.namespace, project, board) visit project_board_path(project, board)
wait_for_requests wait_for_requests
expect(page).to have_selector('.board', count: 3) expect(page).to have_selector('.board', count: 3)
...@@ -47,7 +47,7 @@ describe 'Issue Boards', :feature, :js do ...@@ -47,7 +47,7 @@ describe 'Issue Boards', :feature, :js do
context 'ordering in list' do context 'ordering in list' do
before do before do
visit namespace_project_board_path(project.namespace, project, board) visit project_board_path(project, board)
wait_for_requests wait_for_requests
expect(page).to have_selector('.board', count: 3) expect(page).to have_selector('.board', count: 3)
...@@ -110,7 +110,7 @@ describe 'Issue Boards', :feature, :js do ...@@ -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) } let!(:issue6) { create(:labeled_issue, project: project, title: 'testing 3', labels: [label2], relative_position: 1.0) }
before do before do
visit namespace_project_board_path(project.namespace, project, board) visit project_board_path(project, board)
wait_for_requests wait_for_requests
expect(page).to have_selector('.board', count: 4) expect(page).to have_selector('.board', count: 4)
......
...@@ -8,7 +8,7 @@ describe 'Issue Boards shortcut', feature: true, js: true do ...@@ -8,7 +8,7 @@ describe 'Issue Boards shortcut', feature: true, js: true do
sign_in(create(:admin)) sign_in(create(:admin))
visit namespace_project_path(project.namespace, project) visit project_path(project)
end end
it 'takes user to issue board index' do it 'takes user to issue board index' do
......
...@@ -202,7 +202,7 @@ describe 'Issue Boards add issue modal filtering', :feature, :js do ...@@ -202,7 +202,7 @@ describe 'Issue Boards add issue modal filtering', :feature, :js do
end end
def visit_board def visit_board
visit namespace_project_board_path(project.namespace, project, board) visit project_board_path(project, board)
wait_for_requests wait_for_requests
click_button('Add issues') click_button('Add issues')
......
...@@ -12,7 +12,7 @@ describe 'Issue Boards new issue', feature: true, js: true do ...@@ -12,7 +12,7 @@ describe 'Issue Boards new issue', feature: true, js: true do
sign_in(user) sign_in(user)
visit namespace_project_board_path(project.namespace, project, board) visit project_board_path(project, board)
wait_for_requests wait_for_requests
expect(page).to have_selector('.board', count: 3) expect(page).to have_selector('.board', count: 3)
...@@ -83,7 +83,7 @@ describe 'Issue Boards new issue', feature: true, js: true do ...@@ -83,7 +83,7 @@ describe 'Issue Boards new issue', feature: true, js: true do
context 'unauthorized user' do context 'unauthorized user' do
before do before do
visit namespace_project_board_path(project.namespace, project, board) visit project_board_path(project, board)
wait_for_requests wait_for_requests
end end
......
...@@ -22,7 +22,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -22,7 +22,7 @@ describe 'Issue Boards', feature: true, js: true do
sign_in(user) sign_in(user)
visit namespace_project_board_path(project.namespace, project, board) visit project_board_path(project, board)
wait_for_requests wait_for_requests
end end
......
...@@ -15,7 +15,7 @@ describe 'Sub-group project issue boards', :feature, :js do ...@@ -15,7 +15,7 @@ describe 'Sub-group project issue boards', :feature, :js do
sign_in(user) sign_in(user)
visit namespace_project_board_path(project.namespace, project, board) visit project_board_path(project, board)
wait_for_requests wait_for_requests
end end
......
...@@ -66,7 +66,7 @@ describe 'Commits' do ...@@ -66,7 +66,7 @@ describe 'Commits' do
end end
before do before do
visit namespace_project_commits_path(project.namespace, project, :master) visit project_commits_path(project, :master)
end end
it 'shows correct build status from default branch' do it 'shows correct build status from default branch' do
...@@ -192,7 +192,7 @@ describe 'Commits' do ...@@ -192,7 +192,7 @@ describe 'Commits' do
before do before do
project.team << [user, :master] project.team << [user, :master]
sign_in(user) sign_in(user)
visit namespace_project_commits_path(project.namespace, project, branch_name) visit project_commits_path(project, branch_name)
end end
it 'includes the committed_date for each commit' do it 'includes the committed_date for each commit' do
......
...@@ -55,7 +55,6 @@ describe "Container Registry" do ...@@ -55,7 +55,6 @@ describe "Container Registry" do
end end
def visit_container_registry def visit_container_registry
visit namespace_project_container_registry_index_path( visit project_container_registry_index_path(project)
project.namespace, project)
end end
end end
...@@ -16,7 +16,7 @@ describe 'Copy as GFM', feature: true, js: true do ...@@ -16,7 +16,7 @@ describe 'Copy as GFM', feature: true, js: true do
# `markdown` helper expects a `@project` variable # `markdown` helper expects a `@project` variable
@project = @feat.project @project = @feat.project
visit namespace_project_issue_path(@project.namespace, @project, @feat.issue) visit project_issue_path(@project, @feat.issue)
end end
# The filters referenced in lib/banzai/pipeline/gfm_pipeline.rb convert GitLab Flavored Markdown (GFM) to HTML. # 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 ...@@ -121,13 +121,13 @@ describe 'Copy as GFM', feature: true, js: true do
# full issue reference # full issue reference
@feat.issue.to_reference(full: true), @feat.issue.to_reference(full: true),
# issue URL # issue URL
namespace_project_issue_url(@project.namespace, @project, @feat.issue), project_issue_url(@project, @feat.issue),
# issue URL with note anchor # 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 link
"[Issue](#{namespace_project_issue_url(@project.namespace, @project, @feat.issue)})", "[Issue](#{project_issue_url(@project, @feat.issue)})",
# issue link with note anchor # 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( verify(
...@@ -466,7 +466,7 @@ describe 'Copy as GFM', feature: true, js: true do ...@@ -466,7 +466,7 @@ describe 'Copy as GFM', feature: true, js: true do
context 'from a diff' do context 'from a diff' do
before do before do
visit namespace_project_commit_path(project.namespace, project, sample_commit.id) visit project_commit_path(project, sample_commit.id)
end end
context 'selecting one word of text' do context 'selecting one word of text' do
...@@ -507,7 +507,7 @@ describe 'Copy as GFM', feature: true, js: true do ...@@ -507,7 +507,7 @@ describe 'Copy as GFM', feature: true, js: true do
context 'from a blob' do context 'from a blob' do
before 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 wait_for_requests
end end
...@@ -549,7 +549,7 @@ describe 'Copy as GFM', feature: true, js: true do ...@@ -549,7 +549,7 @@ describe 'Copy as GFM', feature: true, js: true do
context 'from a GFM code block' do context 'from a GFM code block' do
before 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 wait_for_requests
end end
......
...@@ -16,7 +16,7 @@ feature 'Cycle Analytics', feature: true, js: true do ...@@ -16,7 +16,7 @@ feature 'Cycle Analytics', feature: true, js: true do
sign_in(user) sign_in(user)
visit namespace_project_cycle_analytics_path(project.namespace, project) visit project_cycle_analytics_path(project)
wait_for_requests wait_for_requests
end end
...@@ -39,7 +39,7 @@ feature 'Cycle Analytics', feature: true, js: true do ...@@ -39,7 +39,7 @@ feature 'Cycle Analytics', feature: true, js: true do
deploy_master deploy_master
sign_in(user) sign_in(user)
visit namespace_project_cycle_analytics_path(project.namespace, project) visit project_cycle_analytics_path(project)
end end
it 'shows data on each stage' do it 'shows data on each stage' do
...@@ -71,7 +71,7 @@ feature 'Cycle Analytics', feature: true, js: true do ...@@ -71,7 +71,7 @@ feature 'Cycle Analytics', feature: true, js: true do
project.team << [user, :master] project.team << [user, :master]
sign_in(user) sign_in(user)
visit namespace_project_cycle_analytics_path(project.namespace, project) visit project_cycle_analytics_path(project)
wait_for_requests wait_for_requests
end end
...@@ -94,7 +94,7 @@ feature 'Cycle Analytics', feature: true, js: true do ...@@ -94,7 +94,7 @@ feature 'Cycle Analytics', feature: true, js: true do
deploy_master deploy_master
sign_in(guest) sign_in(guest)
visit namespace_project_cycle_analytics_path(project.namespace, project) visit project_cycle_analytics_path(project)
wait_for_requests wait_for_requests
end end
......
...@@ -10,7 +10,7 @@ feature 'Project member activity', feature: true, js: true do ...@@ -10,7 +10,7 @@ feature 'Project member activity', feature: true, js: true do
def visit_activities_and_wait_with_event(event_type) def visit_activities_and_wait_with_event(event_type)
Event.create(project: project, author_id: user.id, action: 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 wait_for_requests
end end
......
...@@ -66,7 +66,7 @@ RSpec.describe 'Dashboard Projects', feature: true do ...@@ -66,7 +66,7 @@ RSpec.describe 'Dashboard Projects', feature: true do
it 'shows that the last pipeline passed' do it 'shows that the last pipeline passed' do
visit dashboard_projects_path 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 end
end end
...@@ -330,7 +330,7 @@ feature 'Dashboard Todos' do ...@@ -330,7 +330,7 @@ feature 'Dashboard Todos' do
end end
it 'links to the pipelines for the merge request' do 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)