File tree Expand file tree Collapse file tree 1 file changed +24
-10
lines changed
Expand file tree Collapse file tree 1 file changed +24
-10
lines changed Original file line number Diff line number Diff line change 2626 Gon . klass = Hash
2727 end
2828
29- it 'output as js correct' do
30- Gon . clear
31- Gon . int = 1
32- Gon . instance_variable_set ( :@request_id , request . object_id )
33- ActionView ::Base . instance_methods . map ( &:to_s ) . include? ( 'include_gon' ) . should == true
34- base = ActionView ::Base . new
35- base . request = request
36- base . include_gon . should == "<script>window.gon = {};" +
37- "gon.int=1;" +
38- "</script>"
29+ describe '#include_gon' do
30+
31+ before ( :each ) do
32+ Gon . clear
33+ Gon . instance_variable_set ( :@request_id , request . object_id )
34+ ActionView ::Base . instance_methods . map ( &:to_s ) . include? ( 'include_gon' ) . should == true
35+ @base = ActionView ::Base . new
36+ @base . request = request
37+ end
38+
39+ it 'outputs correct js with an integer' do
40+ Gon . int = 1
41+ @base . include_gon . should == "<script>window.gon = {};" +
42+ "gon.int=1;" +
43+ "</script>"
44+ end
45+
46+ it 'outputs correct js with a string' do
47+ Gon . str = %q(a'b"c)
48+ @base . include_gon . should == '<script>window.gon = {};' +
49+ %q(gon.str="a'b\"c";) +
50+ '</script>'
51+ end
52+
3953 end
4054
4155 it 'returns exception if try to set public method as variable' do
You can’t perform that action at this time.
0 commit comments