temple 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +2 -8
  3. data/.gitignore +1 -0
  4. data/CHANGES +5 -0
  5. data/README.md +1 -1
  6. data/Rakefile +3 -11
  7. data/lib/temple/erb/parser.rb +1 -1
  8. data/lib/temple/generator.rb +11 -5
  9. data/lib/temple/version.rb +1 -1
  10. data/spec/engine_spec.rb +189 -0
  11. data/{test/test_erb.rb → spec/erb_spec.rb} +11 -11
  12. data/spec/filter_spec.rb +29 -0
  13. data/{test/filters/test_code_merger.rb → spec/filters/code_merger_spec.rb} +7 -7
  14. data/{test/filters/test_control_flow.rb → spec/filters/control_flow_spec.rb} +13 -13
  15. data/{test/filters/test_dynamic_inliner.rb → spec/filters/dynamic_inliner_spec.rb} +18 -18
  16. data/{test/filters/test_eraser.rb → spec/filters/eraser_spec.rb} +9 -9
  17. data/{test/filters/test_escapable.rb → spec/filters/escapable_spec.rb} +10 -10
  18. data/{test/filters/test_multi_flattener.rb → spec/filters/multi_flattener_spec.rb} +4 -4
  19. data/{test/filters/test_static_analyzer.rb → spec/filters/static_analyzer_spec.rb} +6 -8
  20. data/{test/filters/test_static_merger.rb → spec/filters/static_merger_spec.rb} +7 -7
  21. data/{test/filters/test_string_splitter.rb → spec/filters/string_splitter_spec.rb} +4 -5
  22. data/spec/generator_spec.rb +167 -0
  23. data/spec/grammar_spec.rb +47 -0
  24. data/{test/html/test_attribute_merger.rb → spec/html/attribute_merger_spec.rb} +11 -11
  25. data/{test/html/test_attribute_remover.rb → spec/html/attribute_remover_spec.rb} +7 -7
  26. data/{test/html/test_attribute_sorter.rb → spec/html/attribute_sorter_spec.rb} +7 -7
  27. data/{test/html/test_fast.rb → spec/html/fast_spec.rb} +23 -23
  28. data/{test/html/test_pretty.rb → spec/html/pretty_spec.rb} +7 -7
  29. data/spec/map_spec.rb +39 -0
  30. data/{test/mixins/test_dispatcher.rb → spec/mixins/dispatcher_spec.rb} +12 -12
  31. data/{test/mixins/test_grammar_dsl.rb → spec/mixins/grammar_dsl_spec.rb} +19 -19
  32. data/{test/helper.rb → spec/spec_helper.rb} +3 -4
  33. data/{test/test_static_analyzer.rb → spec/static_analyzer_spec.rb} +6 -6
  34. data/spec/utils_spec.rb +39 -0
  35. data/temple.gemspec +1 -1
  36. metadata +28 -28
  37. data/test/test_engine.rb +0 -189
  38. data/test/test_filter.rb +0 -29
  39. data/test/test_generator.rb +0 -158
  40. data/test/test_grammar.rb +0 -47
  41. data/test/test_map.rb +0 -39
  42. data/test/test_utils.rb +0 -39
data/test/test_engine.rb DELETED
@@ -1,189 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require 'helper'
3
-
4
- class Callable1
5
- def call(exp)
6
- exp
7
- end
8
- end
9
-
10
- class Callable2
11
- def call(exp)
12
- exp
13
- end
14
- end
15
-
16
- class MySpecialFilter
17
- def initialize(opts = {})
18
- end
19
-
20
- def call(exp)
21
- exp
22
- end
23
- end
24
-
25
- class TestEngine < Temple::Engine
26
- use(:Parser) do |input|
27
- [:static, input]
28
- end
29
- use :MyFilter1, proc {|exp| exp }
30
- use :MyFilter2, proc {|exp| exp }
31
- use Temple::HTML::Pretty, pretty: true
32
- filter :MultiFlattener
33
- generator :ArrayBuffer
34
- use(:BeforeBeforeLast) { MySpecialFilter }
35
- use :BeforeLast, Callable1.new
36
- use(:Last) { Callable2.new }
37
- end
38
-
39
- describe Temple::Engine do
40
- it 'should build chain' do
41
- TestEngine.chain.size.should.equal 9
42
-
43
- TestEngine.chain[0].first.should.equal :Parser
44
- TestEngine.chain[0].size.should.equal 2
45
- TestEngine.chain[0].last.should.be.instance_of Proc
46
-
47
- TestEngine.chain[1].first.should.equal :MyFilter1
48
- TestEngine.chain[1].size.should.equal 2
49
- TestEngine.chain[1].last.should.be.instance_of Proc
50
-
51
- TestEngine.chain[2].first.should.equal :MyFilter2
52
- TestEngine.chain[2].size.should.equal 2
53
- TestEngine.chain[2].last.should.be.instance_of Proc
54
-
55
- TestEngine.chain[3].first.should.equal :'Temple::HTML::Pretty'
56
- TestEngine.chain[3].size.should.equal 2
57
- TestEngine.chain[3].last.should.be.instance_of Proc
58
-
59
- TestEngine.chain[4].first.should.equal :MultiFlattener
60
- TestEngine.chain[4].size.should.equal 2
61
- TestEngine.chain[4].last.should.be.instance_of Proc
62
-
63
- TestEngine.chain[5].first.should.equal :ArrayBuffer
64
- TestEngine.chain[5].size.should.equal 2
65
- TestEngine.chain[5].last.should.be.instance_of Proc
66
-
67
- TestEngine.chain[6].first.should.equal :BeforeBeforeLast
68
- TestEngine.chain[6].size.should.equal 2
69
- TestEngine.chain[6].last.should.be.instance_of Proc
70
-
71
- TestEngine.chain[7].first.should.equal :BeforeLast
72
- TestEngine.chain[7].size.should.equal 2
73
- TestEngine.chain[7].last.should.be.instance_of Proc
74
-
75
- TestEngine.chain[8].first.should.equal :Last
76
- TestEngine.chain[8].size.should.equal 2
77
- TestEngine.chain[8].last.should.be.instance_of Proc
78
- end
79
-
80
- it 'should instantiate chain' do
81
- call_chain = TestEngine.new.send(:call_chain)
82
- call_chain[0].should.be.instance_of Method
83
- call_chain[1].should.be.instance_of Method
84
- call_chain[2].should.be.instance_of Method
85
- call_chain[3].should.be.instance_of Temple::HTML::Pretty
86
- call_chain[4].should.be.instance_of Temple::Filters::MultiFlattener
87
- call_chain[5].should.be.instance_of Temple::Generators::ArrayBuffer
88
- call_chain[6].should.be.instance_of MySpecialFilter
89
- call_chain[7].should.be.instance_of Callable1
90
- call_chain[8].should.be.instance_of Callable2
91
- end
92
-
93
- it 'should have #append' do
94
- engine = TestEngine.new
95
- call_chain = engine.send(:call_chain)
96
- call_chain.size.should.equal 9
97
-
98
- engine.append :MyFilter3 do |exp|
99
- exp
100
- end
101
-
102
- TestEngine.chain.size.should.equal 9
103
- engine.chain.size.should.equal 10
104
- engine.chain[9].first.should.equal :MyFilter3
105
- engine.chain[9].size.should.equal 2
106
- engine.chain[9].last.should.be.instance_of Proc
107
-
108
- call_chain = engine.send(:call_chain)
109
- call_chain.size.should.equal 10
110
- call_chain[9].should.be.instance_of Method
111
- end
112
-
113
- it 'should have #prepend' do
114
- engine = TestEngine.new
115
- call_chain = engine.send(:call_chain)
116
- call_chain.size.should.equal 9
117
-
118
- engine.prepend :MyFilter0 do |exp|
119
- exp
120
- end
121
-
122
- TestEngine.chain.size.should.equal 9
123
- engine.chain.size.should.equal 10
124
- engine.chain[0].first.should.equal :MyFilter0
125
- engine.chain[0].size.should.equal 2
126
- engine.chain[0].last.should.be.instance_of Proc
127
- engine.chain[1].first.should.equal :Parser
128
-
129
- call_chain = engine.send(:call_chain)
130
- call_chain.size.should.equal 10
131
- call_chain[0].should.be.instance_of Method
132
- end
133
-
134
- it 'should have #after' do
135
- engine = TestEngine.new
136
- engine.after :Parser, :MyFilter0 do |exp|
137
- exp
138
- end
139
- TestEngine.chain.size.should.equal 9
140
- engine.chain.size.should.equal 10
141
- engine.chain[0].first.should.equal :Parser
142
- engine.chain[1].first.should.equal :MyFilter0
143
- engine.chain[2].first.should.equal :MyFilter1
144
- end
145
-
146
- it 'should have #before' do
147
- engine = TestEngine.new
148
- engine.before :MyFilter1, :MyFilter0 do |exp|
149
- exp
150
- end
151
- TestEngine.chain.size.should.equal 9
152
- engine.chain.size.should.equal 10
153
- engine.chain[0].first.should.equal :Parser
154
- engine.chain[1].first.should.equal :MyFilter0
155
- engine.chain[2].first.should.equal :MyFilter1
156
- end
157
-
158
- it 'should have #remove' do
159
- engine = TestEngine.new
160
- engine.remove :MyFilter1
161
- TestEngine.chain.size.should.equal 9
162
- engine.chain.size.should.equal 8
163
- engine.chain[0].first.should.equal :Parser
164
- engine.chain[1].first.should.equal :MyFilter2
165
-
166
- engine = TestEngine.new
167
- engine.remove /Last/
168
- engine.chain.size.should.equal 6
169
- end
170
-
171
- it 'should have #replace' do
172
- engine = TestEngine.new
173
- engine.replace :Parser, :MyParser do |exp|
174
- exp
175
- end
176
- engine.chain.size.should.equal 9
177
- engine.chain[0].first.should.equal :MyParser
178
- end
179
-
180
- it 'should work with inheritance' do
181
- inherited_engine = Class.new(TestEngine)
182
- inherited_engine.chain.size.should.equal 9
183
- inherited_engine.append :MyFilter3 do |exp|
184
- exp
185
- end
186
- inherited_engine.chain.size.should.equal 10
187
- TestEngine.chain.size.should.equal 9
188
- end
189
- end
data/test/test_filter.rb DELETED
@@ -1,29 +0,0 @@
1
- require 'helper'
2
-
3
- class SimpleFilter < Temple::Filter
4
- define_options :key
5
-
6
- def on_test(arg)
7
- [:on_test, arg]
8
- end
9
- end
10
-
11
- describe Temple::Filter do
12
- it 'should support options' do
13
- Temple::Filter.should.respond_to :default_options
14
- Temple::Filter.should.respond_to :set_default_options
15
- Temple::Filter.should.respond_to :define_options
16
- Temple::Filter.new.options.should.be.instance_of Temple::ImmutableMap
17
- SimpleFilter.new(key: 3).options[:key].should.equal 3
18
- end
19
-
20
- it 'should implement call' do
21
- Temple::Filter.new.call([:exp]).should.equal [:exp]
22
- end
23
-
24
- it 'should process expressions' do
25
- filter = SimpleFilter.new
26
- filter.call([:unhandled]).should.equal [:unhandled]
27
- filter.call([:test, 42]).should.equal [:on_test, 42]
28
- end
29
- end
@@ -1,158 +0,0 @@
1
- require 'helper'
2
-
3
- class SimpleGenerator < Temple::Generator
4
- def preamble
5
- "#{buffer} = BUFFER"
6
- end
7
-
8
- def postamble
9
- buffer
10
- end
11
-
12
- def on_static(s)
13
- concat "S:#{s}"
14
- end
15
-
16
- def on_dynamic(s)
17
- concat "D:#{s}"
18
- end
19
-
20
- def on_code(s)
21
- "C:#{s}"
22
- end
23
- end
24
-
25
- describe Temple::Generator do
26
- it 'should compile simple expressions' do
27
- gen = SimpleGenerator.new
28
-
29
- gen.call([:static, 'test']).should.equal '_buf = BUFFER; _buf << (S:test); _buf'
30
- gen.call([:dynamic, 'test']).should.equal '_buf = BUFFER; _buf << (D:test); _buf'
31
- gen.call([:code, 'test']).should.equal '_buf = BUFFER; C:test; _buf'
32
- end
33
-
34
- it 'should compile multi expression' do
35
- gen = SimpleGenerator.new(buffer: "VAR")
36
- gen.call([:multi,
37
- [:static, "static"],
38
- [:dynamic, "dynamic"],
39
- [:code, "code"]
40
- ]).should.equal 'VAR = BUFFER; VAR << (S:static); VAR << (D:dynamic); C:code; VAR'
41
- end
42
-
43
- it 'should compile capture' do
44
- gen = SimpleGenerator.new(buffer: "VAR", capture_generator: SimpleGenerator)
45
- gen.call([:capture, "foo",
46
- [:static, "test"]
47
- ]).should.equal 'VAR = BUFFER; foo = BUFFER; foo << (S:test); foo; VAR'
48
- end
49
-
50
- it 'should compile capture with multi' do
51
- gen = SimpleGenerator.new(buffer: "VAR", capture_generator: SimpleGenerator)
52
- gen.call([:multi,
53
- [:static, "before"],
54
-
55
- [:capture, "foo", [:multi,
56
- [:static, "static"],
57
- [:dynamic, "dynamic"],
58
- [:code, "code"]]],
59
-
60
- [:static, "after"]
61
- ]).should.equal 'VAR = BUFFER; VAR << (S:before); foo = BUFFER; foo << (S:static); ' +
62
- 'foo << (D:dynamic); C:code; foo; VAR << (S:after); VAR'
63
- end
64
-
65
- it 'should compile newlines' do
66
- gen = SimpleGenerator.new(buffer: "VAR")
67
- gen.call([:multi,
68
- [:static, "static"],
69
- [:newline],
70
- [:dynamic, "dynamic"],
71
- [:newline],
72
- [:code, "code"]
73
- ]).should.equal "VAR = BUFFER; VAR << (S:static); \n; " +
74
- "VAR << (D:dynamic); \n; C:code; VAR"
75
- end
76
- end
77
-
78
- describe Temple::Generators::Array do
79
- it 'should compile simple expressions' do
80
- gen = Temple::Generators::Array.new(freeze_static: false)
81
- gen.call([:static, 'test']).should.equal '_buf = []; _buf << ("test"); _buf'
82
- gen.call([:dynamic, 'test']).should.equal '_buf = []; _buf << (test); _buf'
83
- gen.call([:code, 'test']).should.equal '_buf = []; test; _buf'
84
-
85
- gen.call([:multi, [:static, 'a'], [:static, 'b']]).should.equal '_buf = []; _buf << ("a"); _buf << ("b"); _buf'
86
- gen.call([:multi, [:static, 'a'], [:dynamic, 'b']]).should.equal '_buf = []; _buf << ("a"); _buf << (b); _buf'
87
- end
88
-
89
- it 'should freeze static' do
90
- gen = Temple::Generators::Array.new(freeze_static: true)
91
- gen.call([:static, 'test']).should.equal '_buf = []; _buf << ("test".freeze); _buf'
92
- end
93
- end
94
-
95
- describe Temple::Generators::ArrayBuffer do
96
- it 'should compile simple expressions' do
97
- gen = Temple::Generators::ArrayBuffer.new(freeze_static: false)
98
- gen.call([:static, 'test']).should.equal '_buf = "test"'
99
- gen.call([:dynamic, 'test']).should.equal '_buf = (test).to_s'
100
- gen.call([:code, 'test']).should.equal '_buf = []; test; _buf = _buf.join("")'
101
-
102
- gen.call([:multi, [:static, 'a'], [:static, 'b']]).should.equal '_buf = []; _buf << ("a"); _buf << ("b"); _buf = _buf.join("")'
103
- gen.call([:multi, [:static, 'a'], [:dynamic, 'b']]).should.equal '_buf = []; _buf << ("a"); _buf << (b); _buf = _buf.join("")'
104
- end
105
-
106
- it 'should freeze static' do
107
- gen = Temple::Generators::ArrayBuffer.new(freeze_static: true)
108
- gen.call([:static, 'test']).should.equal '_buf = "test"'
109
- gen.call([:multi, [:dynamic, '1'], [:static, 'test']]).should.equal '_buf = []; _buf << (1); _buf << ("test".freeze); _buf = _buf.join("".freeze)'
110
- end
111
- end
112
-
113
- describe Temple::Generators::StringBuffer do
114
- it 'should compile simple expressions' do
115
- gen = Temple::Generators::StringBuffer.new(freeze_static: false)
116
- gen.call([:static, 'test']).should.equal '_buf = "test"'
117
- gen.call([:dynamic, 'test']).should.equal '_buf = (test).to_s'
118
- gen.call([:code, 'test']).should.equal '_buf = \'\'; test; _buf'
119
-
120
- gen.call([:multi, [:static, 'a'], [:static, 'b']]).should.equal '_buf = \'\'; _buf << ("a"); _buf << ("b"); _buf'
121
- gen.call([:multi, [:static, 'a'], [:dynamic, 'b']]).should.equal '_buf = \'\'; _buf << ("a"); _buf << ((b).to_s); _buf'
122
- end
123
-
124
- it 'should freeze static' do
125
- gen = Temple::Generators::StringBuffer.new(freeze_static: true)
126
- gen.call([:static, 'test']).should.equal '_buf = "test"'
127
- gen.call([:multi, [:dynamic, '1'], [:static, 'test']]).should.equal '_buf = \'\'; _buf << ((1).to_s); _buf << ("test".freeze); _buf'
128
- end
129
- end
130
-
131
- describe Temple::Generators::ERB do
132
- it 'should compile simple expressions' do
133
- gen = Temple::Generators::ERB.new
134
- gen.call([:static, 'test']).should.equal 'test'
135
- gen.call([:dynamic, 'test']).should.equal '<%= test %>'
136
- gen.call([:code, 'test']).should.equal '<% test %>'
137
-
138
- gen.call([:multi, [:static, 'a'], [:static, 'b']]).should.equal 'ab'
139
- gen.call([:multi, [:static, 'a'], [:dynamic, 'b']]).should.equal 'a<%= b %>'
140
- end
141
- end
142
-
143
- describe Temple::Generators::RailsOutputBuffer do
144
- it 'should compile simple expressions' do
145
- gen = Temple::Generators::RailsOutputBuffer.new(freeze_static: false)
146
- gen.call([:static, 'test']).should.equal '@output_buffer = output_buffer || ActionView::OutputBuffer.new; ' +
147
- '@output_buffer.safe_concat(("test")); @output_buffer'
148
- gen.call([:dynamic, 'test']).should.equal '@output_buffer = output_buffer || ActionView::OutputBuffer.new; ' +
149
- '@output_buffer.safe_concat(((test).to_s)); @output_buffer'
150
- gen.call([:code, 'test']).should.equal '@output_buffer = output_buffer || ActionView::OutputBuffer.new; ' +
151
- 'test; @output_buffer'
152
- end
153
-
154
- it 'should freeze static' do
155
- gen = Temple::Generators::RailsOutputBuffer.new(freeze_static: true)
156
- gen.call([:static, 'test']).should.equal '@output_buffer = output_buffer || ActionView::OutputBuffer.new; @output_buffer.safe_concat(("test".freeze)); @output_buffer'
157
- end
158
- end
data/test/test_grammar.rb DELETED
@@ -1,47 +0,0 @@
1
- require 'helper'
2
-
3
- describe Temple::Grammar do
4
- it 'should match core expressions' do
5
- Temple::Grammar.should.match [:multi]
6
- Temple::Grammar.should.match [:multi, [:multi]]
7
- Temple::Grammar.should.match [:static, 'Text']
8
- Temple::Grammar.should.match [:dynamic, 'Text']
9
- Temple::Grammar.should.match [:code, 'Text']
10
- Temple::Grammar.should.match [:capture, 'Text', [:multi]]
11
- Temple::Grammar.should.match [:newline]
12
- end
13
-
14
- it 'should not match invalid core expressions' do
15
- Temple::Grammar.should.not.match [:multi, 'String']
16
- Temple::Grammar.should.not.match [:static]
17
- Temple::Grammar.should.not.match [:dynamic, 1]
18
- Temple::Grammar.should.not.match [:code, :sym]
19
- Temple::Grammar.should.not.match [:capture, [:multi]]
20
- Temple::Grammar.should.not.match [:newline, [:multi]]
21
- end
22
-
23
- it 'should match control flow expressions' do
24
- Temple::Grammar.should.match [:if, 'Condition', [:multi]]
25
- Temple::Grammar.should.match [:if, 'Condition', [:multi], [:multi]]
26
- Temple::Grammar.should.match [:block, 'Loop', [:multi]]
27
- Temple::Grammar.should.match [:case, 'Arg', ['Cond1', [:multi]], ['Cond1', [:multi]], [:else, [:multi]]]
28
- Temple::Grammar.should.not.match [:case, 'Arg', [:sym, [:multi]]]
29
- Temple::Grammar.should.match [:cond, ['Cond1', [:multi]], ['Cond2', [:multi]], [:else, [:multi]]]
30
- Temple::Grammar.should.not.match [:cond, [:sym, [:multi]]]
31
- end
32
-
33
- it 'should match escape expression' do
34
- Temple::Grammar.should.match [:escape, true, [:multi]]
35
- Temple::Grammar.should.match [:escape, false, [:multi]]
36
- end
37
-
38
- it 'should match html expressions' do
39
- Temple::Grammar.should.match [:html, :doctype, 'Doctype']
40
- Temple::Grammar.should.match [:html, :comment, [:multi]]
41
- Temple::Grammar.should.match [:html, :tag, 'Tag', [:multi]]
42
- Temple::Grammar.should.match [:html, :tag, 'Tag', [:multi], [:multi]]
43
- Temple::Grammar.should.match [:html, :tag, 'Tag', [:multi], [:static, 'Text']]
44
- Temple::Grammar.should.match [:html, :tag, 'Tag', [:html, :attrs, [:html, :attr, 'id',
45
- [:static, 'val']]], [:static, 'Text']]
46
- end
47
- end
data/test/test_map.rb DELETED
@@ -1,39 +0,0 @@
1
- require 'helper'
2
-
3
- describe Temple::ImmutableMap do
4
- it 'has read accessor' do
5
- hash = Temple::ImmutableMap.new({a: 1},{b: 2, a: 3})
6
- hash[:a].should.equal 1
7
- hash[:b].should.equal 2
8
- end
9
-
10
- it 'has include?' do
11
- hash = Temple::ImmutableMap.new({a: 1},{b: 2, a: 3})
12
- hash.should.include :a
13
- hash.should.include :b
14
- hash.should.not.include :c
15
- end
16
-
17
- it 'has values' do
18
- Temple::ImmutableMap.new({a: 1},{b: 2, a: 3}).values.sort.should.equal [1,2]
19
- end
20
-
21
- it 'has keys' do
22
- Temple::ImmutableMap.new({a: 1},{b: 2, a: 3}).keys.should.equal [:a,:b]
23
- end
24
-
25
- it 'has to_a' do
26
- Temple::ImmutableMap.new({a: 1},{b: 2, a: 3}).to_a.should.equal [[:a, 1], [:b, 2]]
27
- end
28
- end
29
-
30
- describe Temple::MutableMap do
31
- it 'has write accessor' do
32
- parent = {a: 1}
33
- hash = Temple::MutableMap.new(parent)
34
- hash[:a].should.equal 1
35
- hash[:a] = 2
36
- hash[:a].should.equal 2
37
- parent[:a].should.equal 1
38
- end
39
- end
data/test/test_utils.rb DELETED
@@ -1,39 +0,0 @@
1
- require 'helper'
2
-
3
- class UniqueTest
4
- include Temple::Utils
5
- end
6
-
7
- describe Temple::Utils do
8
- it 'has empty_exp?' do
9
- Temple::Utils.empty_exp?([:multi]).should.be.true
10
- Temple::Utils.empty_exp?([:multi, [:multi]]).should.be.true
11
- Temple::Utils.empty_exp?([:multi, [:multi, [:newline]], [:newline]]).should.be.true
12
- Temple::Utils.empty_exp?([:multi]).should.be.true
13
- Temple::Utils.empty_exp?([:multi, [:multi, [:static, 'text']]]).should.be.false
14
- Temple::Utils.empty_exp?([:multi, [:newline], [:multi, [:dynamic, 'text']]]).should.be.false
15
- end
16
-
17
- it 'has unique_name' do
18
- u = UniqueTest.new
19
- u.unique_name.should.equal '_uniquetest1'
20
- u.unique_name.should.equal '_uniquetest2'
21
- UniqueTest.new.unique_name.should.equal '_uniquetest1'
22
- end
23
-
24
- it 'has escape_html' do
25
- Temple::Utils.escape_html('<').should.equal '&lt;'
26
- end
27
-
28
- it 'should escape unsafe html strings' do
29
- with_html_safe do
30
- Temple::Utils.escape_html_safe('<').should.equal '&lt;'
31
- end
32
- end
33
-
34
- it 'should not escape safe html strings' do
35
- with_html_safe do
36
- Temple::Utils.escape_html_safe('<'.html_safe).should.equal '<'
37
- end
38
- end
39
- end