curlybars 1.7.0 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/lib/curlybars/error/lex.rb +1 -1
  3. data/lib/curlybars/error/parse.rb +1 -1
  4. data/lib/curlybars/node/path.rb +11 -13
  5. data/lib/curlybars/presenter.rb +2 -2
  6. data/lib/curlybars/template_handler.rb +3 -11
  7. data/lib/curlybars/version.rb +1 -1
  8. metadata +17 -93
  9. data/spec/acceptance/application_layout_spec.rb +0 -60
  10. data/spec/acceptance/collection_blocks_spec.rb +0 -28
  11. data/spec/acceptance/global_helper_spec.rb +0 -25
  12. data/spec/curlybars/configuration_spec.rb +0 -57
  13. data/spec/curlybars/error/base_spec.rb +0 -41
  14. data/spec/curlybars/error/compile_spec.rb +0 -19
  15. data/spec/curlybars/error/lex_spec.rb +0 -25
  16. data/spec/curlybars/error/parse_spec.rb +0 -74
  17. data/spec/curlybars/error/render_spec.rb +0 -19
  18. data/spec/curlybars/error/validate_spec.rb +0 -19
  19. data/spec/curlybars/lexer_spec.rb +0 -490
  20. data/spec/curlybars/method_whitelist_spec.rb +0 -299
  21. data/spec/curlybars/processor/tilde_spec.rb +0 -60
  22. data/spec/curlybars/rendering_support_spec.rb +0 -421
  23. data/spec/curlybars/safe_buffer_spec.rb +0 -46
  24. data/spec/curlybars/template_handler_spec.rb +0 -225
  25. data/spec/integration/cache_spec.rb +0 -126
  26. data/spec/integration/comment_spec.rb +0 -60
  27. data/spec/integration/exception_spec.rb +0 -31
  28. data/spec/integration/node/block_helper_else_spec.rb +0 -420
  29. data/spec/integration/node/each_else_spec.rb +0 -408
  30. data/spec/integration/node/each_spec.rb +0 -289
  31. data/spec/integration/node/escape_spec.rb +0 -27
  32. data/spec/integration/node/helper_spec.rb +0 -186
  33. data/spec/integration/node/if_else_spec.rb +0 -170
  34. data/spec/integration/node/if_spec.rb +0 -153
  35. data/spec/integration/node/output_spec.rb +0 -66
  36. data/spec/integration/node/partial_spec.rb +0 -64
  37. data/spec/integration/node/path_spec.rb +0 -296
  38. data/spec/integration/node/root_spec.rb +0 -13
  39. data/spec/integration/node/sub_expression_spec.rb +0 -426
  40. data/spec/integration/node/template_spec.rb +0 -84
  41. data/spec/integration/node/unless_else_spec.rb +0 -139
  42. data/spec/integration/node/unless_spec.rb +0 -128
  43. data/spec/integration/node/with_spec.rb +0 -178
  44. data/spec/integration/processor/tilde_spec.rb +0 -38
  45. data/spec/integration/processors_spec.rb +0 -29
  46. data/spec/integration/visitor_spec.rb +0 -154
@@ -1,408 +0,0 @@
1
- describe "{{#each collection}}...{{else}}...{{/each}}" do
2
- let(:global_helpers_providers) { [IntegrationTest::GlobalHelperProvider.new] }
3
-
4
- describe "#compile" do
5
- let(:post) { double("post") }
6
- let(:presenter_class) { IntegrationTest::Presenter }
7
- let(:presenter) { presenter_class.new(double("view_context"), post: post) }
8
-
9
- it "uses each_template when collection is not empty" do
10
- allow(presenter).to receive(:allows_method?).with(:non_empty_collection).and_return(true)
11
- allow(presenter).to receive(:non_empty_collection) { [presenter] }
12
-
13
- template = Curlybars.compile(<<-HBS)
14
- {{#each non_empty_collection}}
15
- each_template
16
- {{else}}
17
- else_template
18
- {{/each}}
19
- HBS
20
-
21
- expect(eval(template)).to resemble(<<-HTML)
22
- each_template
23
- HTML
24
- end
25
-
26
- it "uses else_template when collection is empty" do
27
- allow(presenter).to receive(:allows_method?).with(:empty_collection).and_return(true)
28
- allow(presenter).to receive(:empty_collection).and_return([])
29
-
30
- template = Curlybars.compile(<<-HBS)
31
- {{#each empty_collection}}
32
- each_template
33
- {{else}}
34
- else_template
35
- {{/each}}
36
- HBS
37
-
38
- expect(eval(template)).to resemble(<<-HTML)
39
- else_template
40
- HTML
41
- end
42
-
43
- it "renders {{path}} when collection is not empty" do
44
- path_presenter_class = Class.new(Curlybars::Presenter) do
45
- presents :path
46
- allow_methods :path
47
- def path
48
- @path
49
- end
50
- end
51
-
52
- a_path_presenter = path_presenter_class.new(nil, path: 'a_path')
53
- another_path_presenter = path_presenter_class.new(nil, path: 'another_path')
54
-
55
- allow(presenter).to receive(:allows_method?).with(:non_empty_collection).and_return(true)
56
- allow(presenter).to receive(:non_empty_collection) { [a_path_presenter, another_path_presenter] }
57
-
58
- template = Curlybars.compile(<<-HBS)
59
- {{#each non_empty_collection}}
60
- {{path}}
61
- {{else}}
62
- else_template
63
- {{/each}}
64
- HBS
65
-
66
- expect(eval(template)).to resemble(<<-HTML)
67
- a_path
68
- another_path
69
- HTML
70
- end
71
-
72
- it "allows empty each_template" do
73
- allow(presenter).to receive(:allows_method?).with(:empty_collection).and_return(true)
74
- allow(presenter).to receive(:empty_collection).and_return([])
75
-
76
- template = Curlybars.compile(<<-HBS)
77
- {{#each empty_collection}}{{else}}
78
- else_template
79
- {{/each}}
80
- HBS
81
-
82
- expect(eval(template)).to resemble(<<-HTML)
83
- else_template
84
- HTML
85
- end
86
-
87
- it "allows empty else_template" do
88
- allow(presenter).to receive(:allows_method?).with(:non_empty_collection).and_return(true)
89
- allow(presenter).to receive(:non_empty_collection) { [presenter] }
90
-
91
- template = Curlybars.compile(<<-HBS)
92
- {{#each non_empty_collection}}
93
- each_template
94
- {{else}}{{/each}}
95
- HBS
96
-
97
- expect(eval(template)).to resemble(<<-HTML)
98
- each_template
99
- HTML
100
- end
101
-
102
- it "allows empty each_template and else_template" do
103
- allow(presenter).to receive(:allows_method?).with(:non_empty_collection).and_return(true)
104
- allow(presenter).to receive(:non_empty_collection) { [presenter] }
105
-
106
- template = Curlybars.compile(<<-HBS)
107
- {{#each non_empty_collection}}{{else}}{{/each}}
108
- HBS
109
-
110
- expect(eval(template)).to resemble("")
111
- end
112
-
113
- it "renders nothing if the context is nil" do
114
- template = Curlybars.compile(<<-HBS)
115
- {{#each return_nil}}
116
- each_template
117
- {{else}}
118
- else_template
119
- {{/each}}
120
- HBS
121
-
122
- expect(eval(template)).to resemble(<<-HTML)
123
- else_template
124
- HTML
125
- end
126
-
127
- it "allows subexpressions" do
128
- template = Curlybars.compile(<<-HBS)
129
- {{#each (articles)}}left{{else}}right{{/each}}
130
- HBS
131
-
132
- expected = "left" * presenter.articles.size
133
- expect(eval(template)).to resemble(expected)
134
- end
135
-
136
- it "allows subexpressions with collection helpers" do
137
- template = Curlybars.compile(<<-HBS)
138
- {{#each (reverse_articles)}}
139
- {{title}}
140
- {{else}}
141
- right
142
- {{/each}}
143
- HBS
144
-
145
- expected = presenter.reverse_articles.inject("") { |res, a| res + a.title }
146
- expect(eval(template)).to resemble(expected)
147
- end
148
-
149
- it "allows subexpressions with generic collection helpers" do
150
- template = Curlybars.compile(<<-HBS)
151
- {{#each (refl articles)}}
152
- {{title}}
153
- {{else}}
154
- right
155
- {{/each}}
156
- HBS
157
-
158
- expected = presenter.articles.inject("") { |res, a| res + a.title }
159
- expect(eval(template)).to resemble(expected)
160
- end
161
-
162
- it "raises an error if the context is not an array-like object" do
163
- allow(IntegrationTest::Presenter).to receive(:allows_method?).with(:not_a_collection).and_return(true)
164
- allow(presenter).to receive(:not_a_collection).and_return("string")
165
-
166
- template = Curlybars.compile(<<-HBS)
167
- {{#each not_a_collection}}{{else}}{{/each}}
168
- HBS
169
-
170
- expect do
171
- eval(template)
172
- end.to raise_error(Curlybars::Error::Render)
173
- end
174
-
175
- it "raises an error if the objects inside of the context array are not presenters" do
176
- allow(IntegrationTest::Presenter).to receive(:allows_method?).with(:not_a_presenter_collection).and_return(true)
177
- allow(presenter).to receive(:not_a_presenter_collection).and_return([:an_element])
178
-
179
- template = Curlybars.compile(<<-HBS)
180
- {{#each not_a_presenter_collection}}{{else}}{{/each}}
181
- HBS
182
-
183
- expect do
184
- eval(template)
185
- end.to raise_error(Curlybars::Error::Render)
186
- end
187
- end
188
-
189
- describe "#validate" do
190
- it "without errors" do
191
- dependency_tree = { a_presenter_collection: [{}] }
192
-
193
- source = <<-HBS
194
- {{#each a_presenter_collection}} {{else}} {{/each}}
195
- HBS
196
-
197
- errors = Curlybars.validate(dependency_tree, source)
198
-
199
- expect(errors).to be_empty
200
- end
201
-
202
- it "with errors due to a presenter path" do
203
- dependency_tree = { a_presenter: {} }
204
-
205
- source = <<-HBS
206
- {{#each a_presenter}} {{else}} {{/each}}
207
- HBS
208
-
209
- errors = Curlybars.validate(dependency_tree, source)
210
-
211
- expect(errors).not_to be_empty
212
- end
213
-
214
- it "with errors due to a leaf path" do
215
- dependency_tree = { a_leaf: nil }
216
-
217
- source = <<-HBS
218
- {{#each a_leaf}} {{else}} {{/each}}
219
- HBS
220
-
221
- errors = Curlybars.validate(dependency_tree, source)
222
-
223
- expect(errors).not_to be_empty
224
- end
225
-
226
- it "with errors due unallowed method" do
227
- dependency_tree = {}
228
-
229
- source = <<-HBS
230
- {{#each unallowed}} {{else}} {{/each}}
231
- HBS
232
-
233
- errors = Curlybars.validate(dependency_tree, source)
234
-
235
- expect(errors).not_to be_empty
236
- end
237
-
238
- describe "with subexpressions" do
239
- before do
240
- Curlybars.instance_variable_set(:@global_helpers_dependency_tree, nil)
241
- end
242
-
243
- it "without errors when called with a presenter collection" do
244
- dependency_tree = { a_presenter_collection: [{}] }
245
-
246
- source = <<-HBS
247
- {{#each (a_presenter_collection)}} {{else}} {{/each}}
248
- HBS
249
-
250
- errors = Curlybars.validate(dependency_tree, source)
251
-
252
- expect(errors).to be_empty
253
- end
254
-
255
- it "without errors when called with a collection helper" do
256
- dependency_tree = { a_collection_helper: [:helper, [{ url: nil }]] }
257
-
258
- source = <<-HBS
259
- {{#each (a_collection_helper)}}
260
- {{url}}
261
- {{else}}
262
- right
263
- {{/each}}
264
- HBS
265
-
266
- errors = Curlybars.validate(dependency_tree, source)
267
-
268
- expect(errors).to be_empty
269
- end
270
-
271
- context "with a generic collection helper" do
272
- it "without errors when arguments are valid" do
273
- dependency_tree = {
274
- refl: [:helper, [{}]],
275
- articles: [{ url: nil }]
276
- }
277
-
278
- source = <<-HBS
279
- {{#each (refl articles)}}
280
- {{url}}
281
- {{else}}
282
- right
283
- {{/each}}
284
- HBS
285
-
286
- errors = Curlybars.validate(dependency_tree, source)
287
-
288
- expect(errors).to be_empty
289
- end
290
-
291
- it "with errors when the first argument is not a collection" do
292
- dependency_tree = {
293
- refl: [:helper, [{}]],
294
- articles: { url: nil }
295
- }
296
-
297
- source = <<-HBS
298
- {{#each (refl articles)}}
299
- {{url}}
300
- {{else}}
301
- right
302
- {{/each}}
303
- HBS
304
-
305
- errors = Curlybars.validate(dependency_tree, source)
306
-
307
- expect(errors).not_to be_empty
308
- end
309
-
310
- it "with errors when the first argument is not defined" do
311
- dependency_tree = {
312
- refl: [:helper, [{}]]
313
- }
314
-
315
- source = <<-HBS
316
- {{#each (refl articles)}}
317
- {{url}}
318
- {{else}}
319
- right
320
- {{/each}}
321
- HBS
322
-
323
- errors = Curlybars.validate(dependency_tree, source)
324
-
325
- expect(errors).not_to be_empty
326
- end
327
-
328
- it "with errors when no argument is given" do
329
- dependency_tree = {
330
- refl: [:helper, [{}]]
331
- }
332
-
333
- source = <<-HBS
334
- {{#each (refl)}}
335
- {{url}}
336
- {{else}}
337
- right
338
- {{/each}}
339
- HBS
340
-
341
- errors = Curlybars.validate(dependency_tree, source)
342
-
343
- expect(errors).not_to be_empty
344
- end
345
-
346
- describe "as a global helper" do
347
- let(:global_helpers_provider_classes) { [IntegrationTest::GlobalHelperProvider] }
348
-
349
- before do
350
- allow(Curlybars.configuration).to receive(:global_helpers_provider_classes).and_return(global_helpers_provider_classes)
351
- end
352
-
353
- it "without errors when the first argument is a collection" do
354
- dependency_tree = {
355
- articles: [{ url: nil }]
356
- }
357
-
358
- source = <<-HBS
359
- {{#each (slice articles 0 4)}}
360
- {{url}}
361
- {{else}}
362
- right
363
- {{/each}}
364
- HBS
365
-
366
- errors = Curlybars.validate(dependency_tree, source)
367
-
368
- expect(errors).to be_empty
369
- end
370
-
371
- it "with errors when the first argument is not a collection" do
372
- dependency_tree = {
373
- articles: { url: nil }
374
- }
375
-
376
- source = <<-HBS
377
- {{#each (slice articles 0 4)}}
378
- {{url}}
379
- {{else}}
380
- right
381
- {{/each}}
382
- HBS
383
-
384
- errors = Curlybars.validate(dependency_tree, source)
385
-
386
- expect(errors).not_to be_empty
387
- end
388
-
389
- it "with errors when no argument is given" do
390
- dependency_tree = {}
391
-
392
- source = <<-HBS
393
- {{#each (slice)}}
394
- {{url}}
395
- {{else}}
396
- right
397
- {{/each}}
398
- HBS
399
-
400
- errors = Curlybars.validate(dependency_tree, source)
401
-
402
- expect(errors).not_to be_empty
403
- end
404
- end
405
- end
406
- end
407
- end
408
- end
@@ -1,289 +0,0 @@
1
- describe "{{#each collection}}...{{/each}}" do
2
- let(:global_helpers_providers) { [] }
3
-
4
- describe "#compile" do
5
- let(:post) { double("post") }
6
- let(:presenter) { IntegrationTest::Presenter.new(double("view_context"), post: post) }
7
-
8
- it "uses each_template when collection is not empty" do
9
- allow(presenter).to receive(:allows_method?).with(:non_empty_collection).and_return(true)
10
- allow(presenter).to receive(:non_empty_collection) { [presenter] }
11
-
12
- template = Curlybars.compile(<<-HBS)
13
- {{#each non_empty_collection}}
14
- each_template
15
- {{/each}}
16
- HBS
17
-
18
- expect(eval(template)).to resemble(<<-HTML)
19
- each_template
20
- HTML
21
- end
22
-
23
- it "doesn't use each_template when collection is empty" do
24
- allow(presenter).to receive(:allows_method?).with(:empty_collection).and_return(true)
25
- allow(presenter).to receive(:empty_collection).and_return([])
26
-
27
- template = Curlybars.compile(<<-HBS)
28
- {{#each empty_collection}}
29
- each_template
30
- {{/each}}
31
- HBS
32
-
33
- expect(eval(template)).to resemble("")
34
- end
35
-
36
- it "allows empty each_template" do
37
- allow(presenter).to receive(:allows_method?).with(:non_empty_collection).and_return(true)
38
- allow(presenter).to receive(:non_empty_collection) { [presenter] }
39
-
40
- template = Curlybars.compile(<<-HBS)
41
- {{#each non_empty_collection}}{{/each}}
42
- HBS
43
-
44
- expect(eval(template)).to resemble("")
45
- end
46
-
47
- it "uses each_template when collection is a not empty enumerable" do
48
- path_presenter_class = Class.new(Curlybars::Presenter) do
49
- presents :path
50
- allow_methods :path
51
- def path
52
- @path
53
- end
54
- end
55
-
56
- a_path_presenter = path_presenter_class.new(nil, path: 'a_path')
57
- another_path_presenter = path_presenter_class.new(nil, path: 'another_path')
58
-
59
- allow(presenter).to receive(:allows_method?).with(:non_empty_collection).and_return(true)
60
- allow(presenter).to receive(:non_empty_collection) { [a_path_presenter, another_path_presenter] }
61
-
62
- template = Curlybars.compile(<<-HBS)
63
- {{#each non_empty_collection}}
64
- {{path}}
65
- {{/each}}
66
- HBS
67
-
68
- expect(eval(template)).to resemble(<<-HTML)
69
- a_path
70
- another_path
71
- HTML
72
- end
73
-
74
- it "uses each_template when collection is a not empty hash" do
75
- path_presenter_class = Class.new(Curlybars::Presenter) do
76
- presents :path
77
- allow_methods :path
78
- def path
79
- @path
80
- end
81
- end
82
-
83
- a_path_presenter = path_presenter_class.new(nil, path: 'a_path')
84
- another_path_presenter = path_presenter_class.new(nil, path: 'another_path')
85
-
86
- allow(presenter).to receive(:allows_method?).with(:non_empty_hash).and_return(true)
87
- allow(presenter).to receive(:non_empty_hash) do
88
- { first: a_path_presenter, second: another_path_presenter }
89
- end
90
-
91
- template = Curlybars.compile(<<-HBS)
92
- {{#each non_empty_hash}}
93
- {{path}}
94
- {{/each}}
95
- HBS
96
-
97
- expect(eval(template)).to resemble(<<-HTML)
98
- a_path
99
- another_path
100
- HTML
101
- end
102
-
103
- it "raises an error if the context is not an array-like object" do
104
- allow(presenter).to receive(:allows_method?).with(:not_a_collection).and_return(true)
105
- allow(presenter).to receive(:not_a_collection).and_return("string")
106
-
107
- template = Curlybars.compile(<<-HBS)
108
- {{#each not_a_collection}}{{/each}}
109
- HBS
110
-
111
- expect do
112
- eval(template)
113
- end.to raise_error(Curlybars::Error::Render)
114
- end
115
-
116
- it "renders nothing if the context is nil" do
117
- template = Curlybars.compile(<<-HBS)
118
- {{#each return_nil}}
119
- text
120
- {{/each}}
121
- HBS
122
-
123
- expect(eval(template)).to resemble("")
124
- end
125
-
126
- it "gives access to `@index` variable" do
127
- template = Curlybars.compile(<<-HBS)
128
- {{#each two_elements}}
129
- {{@index}}
130
- {{/each}}
131
- HBS
132
-
133
- expect(eval(template)).to resemble(<<-HTML)
134
- 0
135
- 1
136
- HTML
137
- end
138
-
139
- it "gives access to `@first` variable" do
140
- template = Curlybars.compile(<<-HBS)
141
- {{#each two_elements}}
142
- {{@first}}
143
- {{/each}}
144
- HBS
145
-
146
- expect(eval(template)).to resemble(<<-HTML)
147
- true
148
- false
149
- HTML
150
- end
151
-
152
- it "gives access to `@last` variable" do
153
- template = Curlybars.compile(<<-HBS)
154
- {{#each two_elements}}
155
- {{@last}}
156
- {{/each}}
157
- HBS
158
-
159
- expect(eval(template)).to resemble(<<-HTML)
160
- false
161
- true
162
- HTML
163
- end
164
-
165
- it "gives access to variables from nested {{#with}}" do
166
- template = Curlybars.compile(<<-HBS)
167
- {{#each two_elements}}
168
- {{#with me}}
169
- {{@index}}
170
- {{/with}}
171
- {{/each}}
172
- HBS
173
-
174
- expect(eval(template)).to resemble(<<-HTML)
175
- 0
176
- 1
177
- HTML
178
- end
179
-
180
- it "gives access to variables from nested {{#each}}" do
181
- template = Curlybars.compile(<<-HBS)
182
- {{#each two_elements}}
183
- {{#each ../two_elements}}
184
- {{@../index}}
185
- {{/each}}
186
- {{/each}}
187
- HBS
188
-
189
- expect(eval(template)).to resemble(<<-HTML)
190
- 0
191
- 0
192
- 1
193
- 1
194
- HTML
195
- end
196
-
197
- it "gives access to variables when collection is a not empty hash" do
198
- path_presenter_class = Class.new(Curlybars::Presenter) do
199
- presents :path
200
- allow_methods :path
201
- def path
202
- @path
203
- end
204
- end
205
-
206
- a_path_presenter = path_presenter_class.new(nil, path: 'a_path')
207
- another_path_presenter = path_presenter_class.new(nil, path: 'another_path')
208
-
209
- allow(presenter).to receive(:allows_method?).with(:non_empty_hash).and_return(true)
210
- allow(presenter).to receive(:non_empty_hash) do
211
- { first: a_path_presenter, second: another_path_presenter }
212
- end
213
-
214
- template = Curlybars.compile(<<-HBS)
215
- {{#each non_empty_hash}}
216
- {{@index}}) {{@key}}: {{path}}
217
- {{/each}}
218
- HBS
219
-
220
- expect(eval(template)).to resemble(<<-HTML)
221
- 0) first: a_path
222
- 1) second: another_path
223
- HTML
224
- end
225
-
226
- it "raises an error if the objects inside of the context array are not presenters" do
227
- allow(presenter).to receive(:allows_method?).with(:not_a_presenter_collection).and_return(true)
228
- allow(presenter).to receive(:not_a_presenter_collection).and_return([:an_element])
229
-
230
- template = Curlybars.compile(<<-HBS)
231
- {{#each not_a_presenter_collection}}{{/each}}
232
- HBS
233
-
234
- expect do
235
- eval(template)
236
- end.to raise_error(Curlybars::Error::Render)
237
- end
238
- end
239
-
240
- describe "#validate" do
241
- it "without errors" do
242
- dependency_tree = { a_presenter_collection: [{}] }
243
-
244
- source = <<-HBS
245
- {{#each a_presenter_collection}}{{/each}}
246
- HBS
247
-
248
- errors = Curlybars.validate(dependency_tree, source)
249
-
250
- expect(errors).to be_empty
251
- end
252
-
253
- it "with errors due to a presenter path" do
254
- dependency_tree = { a_presenter: {} }
255
-
256
- source = <<-HBS
257
- {{#each a_presenter}}{{/each}}
258
- HBS
259
-
260
- errors = Curlybars.validate(dependency_tree, source)
261
-
262
- expect(errors).not_to be_empty
263
- end
264
-
265
- it "with errors due to a leaf path" do
266
- dependency_tree = { a_leaf: nil }
267
-
268
- source = <<-HBS
269
- {{#each a_leaf}}{{/each}}
270
- HBS
271
-
272
- errors = Curlybars.validate(dependency_tree, source)
273
-
274
- expect(errors).not_to be_empty
275
- end
276
-
277
- it "with errors due unallowed method" do
278
- dependency_tree = {}
279
-
280
- source = <<-HBS
281
- {{#each unallowed}}{{/each}}
282
- HBS
283
-
284
- errors = Curlybars.validate(dependency_tree, source)
285
-
286
- expect(errors).not_to be_empty
287
- end
288
- end
289
- end
@@ -1,27 +0,0 @@
1
- describe '`\` as an escaping character' do
2
- let(:post) { double("post") }
3
- let(:presenter) { IntegrationTest::Presenter.new(double("view_context"), post: post) }
4
- let(:global_helpers_providers) { [] }
5
-
6
- it "escapes `{`" do
7
- template = Curlybars.compile(<<-HBS)
8
- text \\{{! text
9
- HBS
10
-
11
- expect(eval(template)).to resemble('text {{! text')
12
- end
13
-
14
- it "escapes `\\`" do
15
- template = Curlybars.compile(<<-HBS)
16
- text \\ text
17
- HBS
18
-
19
- expect(eval(template)).to resemble('text \\ text')
20
- end
21
-
22
- it "escapes `\\` at the end of the string" do
23
- template = Curlybars.compile('text \\')
24
-
25
- expect(eval(template)).to resemble('text \\')
26
- end
27
- end