spec/gon/global_spec.rb in gon-5.0.4 vs spec/gon/global_spec.rb in gon-5.1.0
- old
+ new
@@ -75,13 +75,14 @@
"</script>")
end
it 'outputs correct js with a script string' do
Gon.global.str = %q(</script><script>alert('!')</script>)
+ escaped_str = "\"\\u003c/script\\u003e\\u003cscript\\u003ealert('!')\\u003c/script\\u003e\""
expect(@base.include_gon).to eq("<script type=\"text/javascript\">" +
"\n//<![CDATA[\n" +
"window.gon={};" +
- "gon.global={\"str\":\"\\u003C/script><script>alert('!')\\u003C/script>\"};" +
+ "gon.global={\"str\":#{escaped_str}};" +
"\n//]]>\n" +
"</script>")
end
it 'outputs correct js with a unicode line separator' do