diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-06-29 20:06:35 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-07-05 19:11:59 +0300 |
commit | fe13f110412d85c05dc68e5ee1db499f681bf722 (patch) | |
tree | 4a2d172bb5a490ac8cadbcf376fbf815393ef22b /spec/helpers | |
parent | dc7939337e0d72d2391c3bbb3082d644a54195af (diff) |
Create and use project path helpers that only need a project, no namespace
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/application_helper_spec.rb | 2 | ||||
-rw-r--r-- | spec/helpers/gitlab_routing_helper_spec.rb | 12 | ||||
-rw-r--r-- | spec/helpers/issues_helper_spec.rb | 2 | ||||
-rw-r--r-- | spec/helpers/markup_helper_spec.rb | 12 | ||||
-rw-r--r-- | spec/helpers/milestones_helper_spec.rb | 4 | ||||
-rw-r--r-- | spec/helpers/notes_helper_spec.rb | 14 |
6 files changed, 23 insertions, 23 deletions
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index f161dbb4cf0..e0cad1da86a 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -76,7 +76,7 @@ describe ApplicationHelper do allow_any_instance_of(Project).to receive(:avatar_in_git).and_return(true) - avatar_url = "#{gitlab_host}#{namespace_project_avatar_path(project.namespace, project)}" + avatar_url = "#{gitlab_host}#{project_avatar_path(project)}" expect(helper.project_icon(project.full_path).to_s).to match(image_tag(avatar_url)) end end diff --git a/spec/helpers/gitlab_routing_helper_spec.rb b/spec/helpers/gitlab_routing_helper_spec.rb index 14847d0a49e..7a522487a74 100644 --- a/spec/helpers/gitlab_routing_helper_spec.rb +++ b/spec/helpers/gitlab_routing_helper_spec.rb @@ -5,37 +5,37 @@ describe GitlabRoutingHelper do describe '#project_members_url' do let(:project) { build_stubbed(:empty_project) } - it { expect(project_members_url(project)).to eq namespace_project_project_members_url(project.namespace, project) } + it { expect(project_members_url(project)).to eq project_project_members_url(project) } end describe '#project_member_path' do let(:project_member) { create(:project_member) } - it { expect(project_member_path(project_member)).to eq namespace_project_project_member_path(project_member.source.namespace, project_member.source, project_member) } + it { expect(project_member_path(project_member)).to eq project_project_member_path(project_member.source, project_member) } end describe '#request_access_project_members_path' do let(:project) { build_stubbed(:empty_project) } - it { expect(request_access_project_members_path(project)).to eq request_access_namespace_project_project_members_path(project.namespace, project) } + it { expect(request_access_project_members_path(project)).to eq request_access_project_project_members_path(project) } end describe '#leave_project_members_path' do let(:project) { build_stubbed(:empty_project) } - it { expect(leave_project_members_path(project)).to eq leave_namespace_project_project_members_path(project.namespace, project) } + it { expect(leave_project_members_path(project)).to eq leave_project_project_members_path(project) } end describe '#approve_access_request_project_member_path' do let(:project_member) { create(:project_member) } - it { expect(approve_access_request_project_member_path(project_member)).to eq approve_access_request_namespace_project_project_member_path(project_member.source.namespace, project_member.source, project_member) } + it { expect(approve_access_request_project_member_path(project_member)).to eq approve_access_request_project_project_member_path(project_member.source, project_member) } end describe '#resend_invite_project_member_path' do let(:project_member) { create(:project_member) } - it { expect(resend_invite_project_member_path(project_member)).to eq resend_invite_namespace_project_project_member_path(project_member.source.namespace, project_member.source, project_member) } + it { expect(resend_invite_project_member_path(project_member)).to eq resend_invite_project_project_member_path(project_member.source, project_member) } end end diff --git a/spec/helpers/issues_helper_spec.rb b/spec/helpers/issues_helper_spec.rb index 00db98fd9d2..8f7f17a484f 100644 --- a/spec/helpers/issues_helper_spec.rb +++ b/spec/helpers/issues_helper_spec.rb @@ -137,7 +137,7 @@ describe IssuesHelper do let(:merge_request) { create(:merge_request) } it "links just the merge request" do - expected_path = namespace_project_merge_request_path(merge_request.project.namespace, merge_request.project, merge_request) + expected_path = project_merge_request_path(merge_request.project, merge_request) expect(link_to_discussions_to_resolve(merge_request, nil)).to include(expected_path) end diff --git a/spec/helpers/markup_helper_spec.rb b/spec/helpers/markup_helper_spec.rb index b4226f96a04..4b6a351cf70 100644 --- a/spec/helpers/markup_helper_spec.rb +++ b/spec/helpers/markup_helper_spec.rb @@ -25,17 +25,17 @@ describe MarkupHelper do let(:actual) { "#{merge_request.to_reference} -> #{commit.to_reference} -> #{issue.to_reference}" } it "links to the merge request" do - expected = namespace_project_merge_request_path(project.namespace, project, merge_request) + expected = project_merge_request_path(project, merge_request) expect(helper.markdown(actual)).to match(expected) end it "links to the commit" do - expected = namespace_project_commit_path(project.namespace, project, commit) + expected = project_commit_path(project, commit) expect(helper.markdown(actual)).to match(expected) end it "links to the issue" do - expected = namespace_project_issue_path(project.namespace, project, issue) + expected = project_issue_path(project, issue) expect(helper.markdown(actual)).to match(expected) end end @@ -46,7 +46,7 @@ describe MarkupHelper do let(:second_issue) { create(:issue, project: second_project) } it 'links to the issue' do - expected = namespace_project_issue_path(second_project.namespace, second_project, second_issue) + expected = project_issue_path(second_project, second_issue) expect(markdown(actual, project: second_project)).to match(expected) end end @@ -69,7 +69,7 @@ describe MarkupHelper do # First issue link expect(doc.css('a')[1].attr('href')) - .to eq namespace_project_issue_path(project.namespace, project, issues[0]) + .to eq project_issue_path(project, issues[0]) expect(doc.css('a')[1].text).to eq issues[0].to_reference # Internal commit link @@ -78,7 +78,7 @@ describe MarkupHelper do # Second issue link expect(doc.css('a')[3].attr('href')) - .to eq namespace_project_issue_path(project.namespace, project, issues[1]) + .to eq project_issue_path(project, issues[1]) expect(doc.css('a')[3].text).to eq issues[1].to_reference # Trailing commit link diff --git a/spec/helpers/milestones_helper_spec.rb b/spec/helpers/milestones_helper_spec.rb index 24d4f1b4938..b8f9c02a486 100644 --- a/spec/helpers/milestones_helper_spec.rb +++ b/spec/helpers/milestones_helper_spec.rb @@ -10,7 +10,7 @@ describe MilestonesHelper do it 'returns project milestones JSON URL' do assign(:project, project) - expect(helper.milestones_filter_dropdown_path).to eq(namespace_project_milestones_path(project.namespace, project, :json)) + expect(helper.milestones_filter_dropdown_path).to eq(project_milestones_path(project, :json)) end end @@ -18,7 +18,7 @@ describe MilestonesHelper do it 'returns targeted project milestones JSON URL' do assign(:target_project, project2) - expect(helper.milestones_filter_dropdown_path).to eq(namespace_project_milestones_path(project2.namespace, project2, :json)) + expect(helper.milestones_filter_dropdown_path).to eq(project_milestones_path(project2, :json)) end end diff --git a/spec/helpers/notes_helper_spec.rb b/spec/helpers/notes_helper_spec.rb index cc861af8533..56f252ba273 100644 --- a/spec/helpers/notes_helper_spec.rb +++ b/spec/helpers/notes_helper_spec.rb @@ -53,7 +53,7 @@ describe NotesHelper do let(:discussion) { create(:diff_note_on_merge_request, noteable: merge_request, project: project).to_discussion } it 'returns the diff path with the line code' do - expect(helper.discussion_path(discussion)).to eq(diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, anchor: discussion.line_code)) + expect(helper.discussion_path(discussion)).to eq(diffs_project_merge_request_path(project, merge_request, anchor: discussion.line_code)) end end @@ -77,7 +77,7 @@ describe NotesHelper do end it 'returns the diff version path with the line code' do - expect(helper.discussion_path(discussion)).to eq(diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, diff_id: merge_request_diff1, anchor: discussion.line_code)) + expect(helper.discussion_path(discussion)).to eq(diffs_project_merge_request_path(project, merge_request, diff_id: merge_request_diff1, anchor: discussion.line_code)) end end @@ -101,7 +101,7 @@ describe NotesHelper do end it 'returns the diff version comparison path with the line code' do - expect(helper.discussion_path(discussion)).to eq(diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, diff_id: merge_request_diff3, start_sha: merge_request_diff1.head_commit_sha, anchor: discussion.line_code)) + expect(helper.discussion_path(discussion)).to eq(diffs_project_merge_request_path(project, merge_request, diff_id: merge_request_diff3, start_sha: merge_request_diff1.head_commit_sha, anchor: discussion.line_code)) end end @@ -129,7 +129,7 @@ describe NotesHelper do end it 'returns the diff path with the line code' do - expect(helper.discussion_path(discussion)).to eq(diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, anchor: discussion.line_code)) + expect(helper.discussion_path(discussion)).to eq(diffs_project_merge_request_path(project, merge_request, anchor: discussion.line_code)) end end @@ -160,7 +160,7 @@ describe NotesHelper do let(:discussion) { create(:diff_note_on_commit, project: project).to_discussion } it 'returns the commit path with the line code' do - expect(helper.discussion_path(discussion)).to eq(namespace_project_commit_path(project.namespace, project, commit, anchor: discussion.line_code)) + expect(helper.discussion_path(discussion)).to eq(project_commit_path(project, commit, anchor: discussion.line_code)) end end @@ -168,7 +168,7 @@ describe NotesHelper do let(:discussion) { create(:legacy_diff_note_on_commit, project: project).to_discussion } it 'returns the commit path with the line code' do - expect(helper.discussion_path(discussion)).to eq(namespace_project_commit_path(project.namespace, project, commit, anchor: discussion.line_code)) + expect(helper.discussion_path(discussion)).to eq(project_commit_path(project, commit, anchor: discussion.line_code)) end end @@ -176,7 +176,7 @@ describe NotesHelper do let(:discussion) { create(:discussion_note_on_commit, project: project).to_discussion } it 'returns the commit path' do - expect(helper.discussion_path(discussion)).to eq(namespace_project_commit_path(project.namespace, project, commit)) + expect(helper.discussion_path(discussion)).to eq(project_commit_path(project, commit)) end end end |