diff options
| author | Robert Speicher <rspeicher@gmail.com> | 2012-09-19 19:42:26 -0400 |
|---|---|---|
| committer | Robert Speicher <rspeicher@gmail.com> | 2012-09-19 19:42:26 -0400 |
| commit | 496f88afe10f95a7aa64ea8ab10e57412f827283 (patch) | |
| tree | 3a2ed682651cd0cc8d710c932e2ce99424e23350 /spec/helpers | |
| parent | 01974185a1640ed869417131d062b5a2eef620bc (diff) | |
| download | gitlab-ce-496f88afe10f95a7aa64ea8ab10e57412f827283.tar.gz | |
Escape text passed to gfm by link_to_gfm
Diffstat (limited to 'spec/helpers')
| -rw-r--r-- | spec/helpers/gitlab_markdown_helper_spec.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/helpers/gitlab_markdown_helper_spec.rb b/spec/helpers/gitlab_markdown_helper_spec.rb index 0af331424f5..a6708a7acd6 100644 --- a/spec/helpers/gitlab_markdown_helper_spec.rb +++ b/spec/helpers/gitlab_markdown_helper_spec.rb @@ -292,11 +292,18 @@ describe GitlabMarkdownHelper do actual = link_to_gfm("Fixed in #{commit.id}", commit_path, class: 'foo') actual.should have_selector 'a.gfm.gfm-commit.foo' end + + it "escapes HTML passed in as the body" do + actual = "This is a <h1>test</h1> - see ##{issues[0].id}" + link_to_gfm(actual, commit_path).should match('<h1>test</h1>') + end end describe "#markdown" do it "should handle references in paragraphs" do - markdown("\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit. #{commit.id} Nam pulvinar sapien eget odio adipiscing at faucibus orci vestibulum.\n").should == "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. #{link_to commit.id, project_commit_path(project, commit), title: commit.link_title, class: "gfm gfm-commit "} Nam pulvinar sapien eget odio adipiscing at faucibus orci vestibulum.</p>\n" + actual = "\n\nLorem ipsum dolor sit amet. #{commit.id} Nam pulvinar sapien eget.\n" + expected = project_commit_path(project, commit) + markdown(actual).should match(expected) end it "should handle references in headers" do |
