diff options
| author | Riyad Preukschas <riyad@informatik.uni-bremen.de> | 2012-08-02 02:28:50 +0200 |
|---|---|---|
| committer | Riyad Preukschas <riyad@informatik.uni-bremen.de> | 2012-08-02 02:54:01 +0200 |
| commit | 6873d07f62f51686f71ac7d31a06ae2124062235 (patch) | |
| tree | 1ff890a76a278c8a07655d02fc2c137967410711 /spec/helpers | |
| parent | 8ce390333a7e08c2956d6334f587e1db7668133e (diff) | |
| download | gitlab-ce-6873d07f62f51686f71ac7d31a06ae2124062235.tar.gz | |
Add link_to_gfm helper and specs
Diffstat (limited to 'spec/helpers')
| -rw-r--r-- | spec/helpers/gitlab_flavored_markdown_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/helpers/gitlab_flavored_markdown_spec.rb b/spec/helpers/gitlab_flavored_markdown_spec.rb index ec31cd1011e..f64362faae5 100644 --- a/spec/helpers/gitlab_flavored_markdown_spec.rb +++ b/spec/helpers/gitlab_flavored_markdown_spec.rb @@ -163,4 +163,17 @@ describe ApplicationHelper do gfm("fixed in #{@commit.id}", :class => "foo").should have_selector("a.foo") end end + + describe "#link_to_gfm" do + let(:issue1) { Factory :issue, :assignee => @fake_user, :author => @fake_user, :project => @project } + let(:issue2) { Factory :issue, :assignee => @fake_user, :author => @fake_user, :project => @project } + + it "should handle references nested in links with all the text" do + link_to_gfm("This should finally fix ##{issue1.id} and ##{issue2.id} for real", project_commit_path(@project, :id => @commit.id)).should == "#{link_to "This should finally fix ", project_commit_path(@project, :id => @commit.id)}#{link_to "##{issue1.id}", project_issue_path(@project, issue1), :title => "Issue: #{issue1.title}", :class => "gfm gfm-issue "}#{link_to " and ", project_commit_path(@project, :id => @commit.id)}#{link_to "##{issue2.id}", project_issue_path(@project, issue2), :title => "Issue: #{issue2.title}", :class => "gfm gfm-issue "}#{link_to " for real", project_commit_path(@project, :id => @commit.id)}" + end + + it "should forward HTML options" do + link_to_gfm("This should finally fix ##{issue1.id} for real", project_commit_path(@project, :id => @commit.id), :class => "foo").should have_selector(".foo") + end + end end |
