summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-08-18 22:59:19 +0000
committerRobert Speicher <robert@gitlab.com>2016-08-18 22:59:19 +0000
commite26ce27d5bac302785086d426e7b1a4c5b33f74a (patch)
tree1e8efcc61d2e4e62aea64282904d1edc47475868 /spec
parent717366d28da11acc6dbe60301bf7e2394400b3c1 (diff)
parent01fc7633d089faad3314bb8bc1a70d27c27aef70 (diff)
downloadgitlab-ce-e26ce27d5bac302785086d426e7b1a4c5b33f74a.tar.gz
Merge branch 'rs-issue-21017' into 'master'
Update Hamlit to 2.6.1 Fixes gitlab-org/gitlab-ce#21025 and gitlab-org/gitlab-ce#21017 See merge request !5873
Diffstat (limited to 'spec')
-rw-r--r--spec/helpers/page_layout_helper_spec.rb9
-rw-r--r--spec/views/layouts/_head.html.haml_spec.rb36
2 files changed, 45 insertions, 0 deletions
diff --git a/spec/helpers/page_layout_helper_spec.rb b/spec/helpers/page_layout_helper_spec.rb
index cf632f594c7..dc07657e101 100644
--- a/spec/helpers/page_layout_helper_spec.rb
+++ b/spec/helpers/page_layout_helper_spec.rb
@@ -97,5 +97,14 @@ describe PageLayoutHelper do
expect(tags).to include %q(<meta property="twitter:data1" content="bar" />)
end
end
+
+ it 'escapes content' do
+ allow(helper).to receive(:page_card_attributes)
+ .and_return(foo: %q{foo" http-equiv="refresh}.html_safe)
+
+ tags = helper.page_card_meta_tags
+
+ expect(tags).to include(%q{content="foo&quot; http-equiv=&quot;refresh"})
+ end
end
end
diff --git a/spec/views/layouts/_head.html.haml_spec.rb b/spec/views/layouts/_head.html.haml_spec.rb
new file mode 100644
index 00000000000..3fddfb3b62f
--- /dev/null
+++ b/spec/views/layouts/_head.html.haml_spec.rb
@@ -0,0 +1,36 @@
+require 'spec_helper'
+
+describe 'layouts/_head' do
+ before do
+ stub_template 'layouts/_user_styles.html.haml' => ''
+ end
+
+ it 'escapes HTML-safe strings in page_title' do
+ stub_helper_with_safe_string(:page_title)
+
+ render
+
+ expect(rendered).to match(%{content="foo&quot; http-equiv=&quot;refresh"})
+ end
+
+ it 'escapes HTML-safe strings in page_description' do
+ stub_helper_with_safe_string(:page_description)
+
+ render
+
+ expect(rendered).to match(%{content="foo&quot; http-equiv=&quot;refresh"})
+ end
+
+ it 'escapes HTML-safe strings in page_image' do
+ stub_helper_with_safe_string(:page_image)
+
+ render
+
+ expect(rendered).to match(%{content="foo&quot; http-equiv=&quot;refresh"})
+ end
+
+ def stub_helper_with_safe_string(method)
+ allow_any_instance_of(PageLayoutHelper).to receive(method)
+ .and_return(%q{foo" http-equiv="refresh}.html_safe)
+ end
+end