Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2012-09-20 03:42:26 +0400
committerRobert Speicher <rspeicher@gmail.com>2012-09-20 03:42:26 +0400
commit496f88afe10f95a7aa64ea8ab10e57412f827283 (patch)
tree3a2ed682651cd0cc8d710c932e2ce99424e23350 /spec/helpers
parent01974185a1640ed869417131d062b5a2eef620bc (diff)
Escape text passed to gfm by link_to_gfm
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/gitlab_markdown_helper_spec.rb9
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('&lt;h1&gt;test&lt;/h1&gt;')
+ 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