diff options
| author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-08-20 16:56:05 +0300 |
|---|---|---|
| committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-08-20 16:56:05 +0300 |
| commit | a73e068c06532480137b8b9861ed88f42578bb12 (patch) | |
| tree | 88d51471ba62aa9a7315a6775ea7a97baac73d69 /spec/helpers | |
| parent | 434c034159f584348b56a322dbcda8dc65b812f2 (diff) | |
| download | gitlab-ce-a73e068c06532480137b8b9861ed88f42578bb12.tar.gz | |
Fixing tests after adding iid for issues/mr
Diffstat (limited to 'spec/helpers')
| -rw-r--r-- | spec/helpers/gitlab_markdown_helper_spec.rb | 38 | ||||
| -rw-r--r-- | spec/helpers/issues_helper_spec.rb | 6 |
2 files changed, 22 insertions, 22 deletions
diff --git a/spec/helpers/gitlab_markdown_helper_spec.rb b/spec/helpers/gitlab_markdown_helper_spec.rb index 2dcc61e9560..a4db8b4ff7e 100644 --- a/spec/helpers/gitlab_markdown_helper_spec.rb +++ b/spec/helpers/gitlab_markdown_helper_spec.rb @@ -20,7 +20,7 @@ describe GitlabMarkdownHelper do describe "#gfm" do it "should return unaltered text if project is nil" do - actual = "Testing references: ##{issue.id}" + actual = "Testing references: ##{issue.iid}" gfm(actual).should_not == actual @@ -175,14 +175,14 @@ describe GitlabMarkdownHelper do describe "referencing an issue" do let(:object) { issue } - let(:reference) { "##{issue.id}" } + let(:reference) { "##{issue.iid}" } include_examples 'referenced object' end describe "referencing a merge request" do let(:object) { merge_request } - let(:reference) { "!#{merge_request.id}" } + let(:reference) { "!#{merge_request.iid}" } include_examples 'referenced object' end @@ -230,7 +230,7 @@ describe GitlabMarkdownHelper do end describe "referencing multiple objects" do - let(:actual) { "!#{merge_request.id} -> #{commit.id} -> ##{issue.id}" } + let(:actual) { "!#{merge_request.iid} -> #{commit.id} -> ##{issue.iid}" } it "should link to the merge request" do expected = project_merge_request_path(project, merge_request) @@ -299,7 +299,7 @@ describe GitlabMarkdownHelper do let(:issues) { create_list(:issue, 2, project: project) } it "should handle references nested in links with all the text" do - actual = link_to_gfm("This should finally fix ##{issues[0].id} and ##{issues[1].id} for real", commit_path) + actual = link_to_gfm("This should finally fix ##{issues[0].iid} and ##{issues[1].iid} for real", commit_path) # Break the result into groups of links with their content, without # closing tags @@ -311,7 +311,7 @@ describe GitlabMarkdownHelper do # First issue link groups[1].should match(/href="#{project_issue_url(project, issues[0])}"/) - groups[1].should match(/##{issues[0].id}$/) + groups[1].should match(/##{issues[0].iid}$/) # Internal commit link groups[2].should match(/href="#{commit_path}"/) @@ -319,7 +319,7 @@ describe GitlabMarkdownHelper do # Second issue link groups[3].should match(/href="#{project_issue_url(project, issues[1])}"/) - groups[3].should match(/##{issues[1].id}$/) + groups[3].should match(/##{issues[1].iid}$/) # Trailing commit link groups[4].should match(/href="#{commit_path}"/) @@ -332,7 +332,7 @@ describe GitlabMarkdownHelper do end it "escapes HTML passed in as the body" do - actual = "This is a <h1>test</h1> - see ##{issues[0].id}" + actual = "This is a <h1>test</h1> - see ##{issues[0].iid}" link_to_gfm(actual, commit_path).should match('<h1>test</h1>') end end @@ -345,25 +345,25 @@ describe GitlabMarkdownHelper do end it "should handle references in headers" do - actual = "\n# Working around ##{issue.id}\n## Apply !#{merge_request.id}" + actual = "\n# Working around ##{issue.iid}\n## Apply !#{merge_request.iid}" - markdown(actual).should match(%r{<h1[^<]*>Working around <a.+>##{issue.id}</a></h1>}) - markdown(actual).should match(%r{<h2[^<]*>Apply <a.+>!#{merge_request.id}</a></h2>}) + markdown(actual).should match(%r{<h1[^<]*>Working around <a.+>##{issue.iid}</a></h1>}) + markdown(actual).should match(%r{<h2[^<]*>Apply <a.+>!#{merge_request.iid}</a></h2>}) end it "should handle references in lists" do project.team << [user, :master] - actual = "\n* dark: ##{issue.id}\n* light by @#{member.user.username}" + actual = "\n* dark: ##{issue.iid}\n* light by @#{member.user.username}" - markdown(actual).should match(%r{<li>dark: <a.+>##{issue.id}</a></li>}) + markdown(actual).should match(%r{<li>dark: <a.+>##{issue.iid}</a></li>}) markdown(actual).should match(%r{<li>light by <a.+>@#{member.user.username}</a></li>}) end it "should handle references in <em>" do - actual = "Apply _!#{merge_request.id}_ ASAP" + actual = "Apply _!#{merge_request.iid}_ ASAP" - markdown(actual).should match(%r{Apply <em><a.+>!#{merge_request.id}</a></em>}) + markdown(actual).should match(%r{Apply <em><a.+>!#{merge_request.iid}</a></em>}) end it "should leave code blocks untouched" do @@ -379,19 +379,19 @@ describe GitlabMarkdownHelper do end it "should leave ref-like autolinks untouched" do - markdown("look at http://example.tld/#!#{merge_request.id}").should == "<p>look at <a href=\"http://example.tld/#!#{merge_request.id}\">http://example.tld/#!#{merge_request.id}</a></p>\n" + markdown("look at http://example.tld/#!#{merge_request.iid}").should == "<p>look at <a href=\"http://example.tld/#!#{merge_request.iid}\">http://example.tld/#!#{merge_request.iid}</a></p>\n" end it "should leave ref-like href of 'manual' links untouched" do - markdown("why not [inspect !#{merge_request.id}](http://example.tld/#!#{merge_request.id})").should == "<p>why not <a href=\"http://example.tld/#!#{merge_request.id}\">inspect </a><a href=\"#{project_merge_request_url(project, merge_request)}\" class=\"gfm gfm-merge_request \" title=\"Merge Request: #{merge_request.title}\">!#{merge_request.id}</a><a href=\"http://example.tld/#!#{merge_request.id}\"></a></p>\n" + markdown("why not [inspect !#{merge_request.iid}](http://example.tld/#!#{merge_request.iid})").should == "<p>why not <a href=\"http://example.tld/#!#{merge_request.iid}\">inspect </a><a href=\"#{project_merge_request_url(project, merge_request)}\" class=\"gfm gfm-merge_request \" title=\"Merge Request: #{merge_request.title}\">!#{merge_request.iid}</a><a href=\"http://example.tld/#!#{merge_request.iid}\"></a></p>\n" end it "should leave ref-like src of images untouched" do - markdown("screen shot: ").should == "<p>screen shot: <img src=\"http://example.tld/#!#{merge_request.id}\" alt=\"some image\"></p>\n" + markdown("screen shot: ").should == "<p>screen shot: <img src=\"http://example.tld/#!#{merge_request.iid}\" alt=\"some image\"></p>\n" end it "should generate absolute urls for refs" do - markdown("##{issue.id}").should include(project_issue_url(project, issue)) + markdown("##{issue.iid}").should include(project_issue_url(project, issue)) end it "should generate absolute urls for emoji" do diff --git a/spec/helpers/issues_helper_spec.rb b/spec/helpers/issues_helper_spec.rb index a1f23073582..3595af32431 100644 --- a/spec/helpers/issues_helper_spec.rb +++ b/spec/helpers/issues_helper_spec.rb @@ -8,7 +8,7 @@ describe IssuesHelper do describe :title_for_issue do it "should return issue title if used internal tracker" do @project = project - title_for_issue(issue.id).should eq issue.title + title_for_issue(issue.iid).should eq issue.title end it "should always return empty string if used external tracker" do @@ -61,7 +61,7 @@ describe IssuesHelper do it "should return internal path if used internal tracker" do @project = project - url_for_issue(issue.id).should match(int_expected) + url_for_issue(issue.iid).should match(int_expected) end it "should return path to external tracker" do @@ -73,7 +73,7 @@ describe IssuesHelper do it "should return empty string if project nil" do @project = nil - url_for_issue(issue.id).should eq "" + url_for_issue(issue.iid).should eq "" end end |
