curlybars 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ac2159267f94390174bc6600a6e4fbabbf5326b747d4c6bac598050349497f1c
4
- data.tar.gz: 07c1db6d440eebc4a9fc3782e17ef52dca1a59b336c444895ade969440f25819
3
+ metadata.gz: ffd4c878a09558bd0d7a796da62d69f5c871634d00a904ac949801b02fdbeeac
4
+ data.tar.gz: 48e2a90bb4b69275bcc619f741a28c0292a0094065a76a8223e2808a397e4f28
5
5
  SHA512:
6
- metadata.gz: 1ff319898fc68828e72bbe653e788238a2c463c210e940534e99f130d5dd5ebc54d17c3a7bc48b58ee342a102a114907599a4824d6ade5d93166e9748bf020ae
7
- data.tar.gz: be909bc79f61e9c3fbfd2876ec04aec7c6546da47f8a5ef5de814547907ae4da144294cc09d34b0383d4031f7c6cda352f967524a2293a1e4c35cb802c348bc1
6
+ metadata.gz: de10a323a835c7f9909ffc429ea74f178f6da7c189360256bc7b861e0785c4bdc5d8a78e40671245fe3dd45a71d6e971148424ef4f26d4c1d6d898b5a8f46e1c
7
+ data.tar.gz: f9c2f4bebff76ca529dacff54293d5908da92e3939c599d4c2a4138948a13e3074d874bda5303ca69f98c4ab37c4296ff02bf89fa0ad2919a760a79372f16a3b
@@ -15,7 +15,7 @@ module Curlybars
15
15
 
16
16
  def validate(branches)
17
17
  [
18
- expression.validate(branches),
18
+ expression.validate(branches, check_type: :not_helper),
19
19
  if_template.validate(branches),
20
20
  else_template.validate(branches)
21
21
  ]
@@ -127,6 +127,10 @@ module Curlybars
127
127
  return if helper?(branches)
128
128
  message = "`#{path}` cannot resolve to a helper"
129
129
  raise Curlybars::Error::Validate.new('not_a_helper', message, position)
130
+ when :not_helper
131
+ return unless helper?(branches)
132
+ message = "`#{path}` resolves to a helper"
133
+ raise Curlybars::Error::Validate.new('is_a_helper', message, position)
130
134
  when :anything
131
135
  else
132
136
  raise "invalid type `#{check_type}`"
@@ -15,7 +15,7 @@ module Curlybars
15
15
 
16
16
  def validate(branches)
17
17
  [
18
- expression.validate(branches),
18
+ expression.validate(branches, check_type: :not_helper),
19
19
  unless_template.validate(branches),
20
20
  else_template.validate(branches)
21
21
  ]
@@ -1,3 +1,3 @@
1
1
  module Curlybars
2
- VERSION = '1.1.0'.freeze
2
+ VERSION = '1.1.1'.freeze
3
3
  end
@@ -139,5 +139,17 @@ describe "{{#if}}...{{/if}}" do
139
139
 
140
140
  expect(errors).not_to be_empty
141
141
  end
142
+
143
+ it "validates with errors the helper as condition" do
144
+ dependency_tree = { helper: :helper }
145
+
146
+ source = <<-HBS
147
+ {{#if helper}}{{/if}}
148
+ HBS
149
+
150
+ errors = Curlybars.validate(dependency_tree, source)
151
+
152
+ expect(errors).not_to be_empty
153
+ end
142
154
  end
143
155
  end
@@ -96,6 +96,18 @@ describe "{{#unless}}...{{else}}...{{/unless}}" do
96
96
  expect(errors).not_to be_empty
97
97
  end
98
98
 
99
+ it "validates with errors the helper as condition" do
100
+ dependency_tree = { helper: :helper }
101
+
102
+ source = <<-HBS
103
+ {{#unless helper}}{{/unless}}
104
+ HBS
105
+
106
+ errors = Curlybars.validate(dependency_tree, source)
107
+
108
+ expect(errors).not_to be_empty
109
+ end
110
+
99
111
  it "validates with errors the nested unless_template" do
100
112
  dependency_tree = { condition: nil }
101
113
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: curlybars
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Libo Cannici
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2018-05-23 00:00:00.000000000 Z
16
+ date: 2018-08-16 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: actionpack
@@ -271,44 +271,44 @@ required_rubygems_version: !ruby/object:Gem::Requirement
271
271
  version: '0'
272
272
  requirements: []
273
273
  rubyforge_project:
274
- rubygems_version: 2.7.6
274
+ rubygems_version: 2.7.3
275
275
  signing_key:
276
276
  specification_version: 4
277
277
  summary: Create your views using Handlebars templates!
278
278
  test_files:
279
- - spec/acceptance/application_layout_spec.rb
280
- - spec/acceptance/collection_blocks_spec.rb
281
- - spec/acceptance/global_helper_spec.rb
279
+ - spec/curlybars/rendering_support_spec.rb
280
+ - spec/curlybars/method_whitelist_spec.rb
282
281
  - spec/curlybars/configuration_spec.rb
283
- - spec/curlybars/error/base_spec.rb
282
+ - spec/curlybars/processor/tilde_spec.rb
283
+ - spec/curlybars/template_handler_spec.rb
284
284
  - spec/curlybars/error/compile_spec.rb
285
- - spec/curlybars/error/lex_spec.rb
286
- - spec/curlybars/error/parse_spec.rb
287
285
  - spec/curlybars/error/render_spec.rb
286
+ - spec/curlybars/error/parse_spec.rb
288
287
  - spec/curlybars/error/validate_spec.rb
289
- - spec/curlybars/lexer_spec.rb
290
- - spec/curlybars/method_whitelist_spec.rb
291
- - spec/curlybars/processor/tilde_spec.rb
292
- - spec/curlybars/rendering_support_spec.rb
288
+ - spec/curlybars/error/lex_spec.rb
289
+ - spec/curlybars/error/base_spec.rb
293
290
  - spec/curlybars/safe_buffer_spec.rb
294
- - spec/curlybars/template_handler_spec.rb
295
- - spec/integration/cache_spec.rb
296
- - spec/integration/comment_spec.rb
291
+ - spec/curlybars/lexer_spec.rb
292
+ - spec/integration/processor/tilde_spec.rb
297
293
  - spec/integration/exception_spec.rb
298
- - spec/integration/node/block_helper_else_spec.rb
299
- - spec/integration/node/each_else_spec.rb
300
- - spec/integration/node/each_spec.rb
294
+ - spec/integration/processors_spec.rb
301
295
  - spec/integration/node/escape_spec.rb
302
- - spec/integration/node/helper_spec.rb
303
- - spec/integration/node/if_else_spec.rb
304
- - spec/integration/node/if_spec.rb
296
+ - spec/integration/node/unless_else_spec.rb
305
297
  - spec/integration/node/output_spec.rb
298
+ - spec/integration/node/if_spec.rb
299
+ - spec/integration/node/unless_spec.rb
300
+ - spec/integration/node/with_spec.rb
306
301
  - spec/integration/node/partial_spec.rb
307
- - spec/integration/node/path_spec.rb
302
+ - spec/integration/node/block_helper_else_spec.rb
308
303
  - spec/integration/node/root_spec.rb
309
304
  - spec/integration/node/template_spec.rb
310
- - spec/integration/node/unless_else_spec.rb
311
- - spec/integration/node/unless_spec.rb
312
- - spec/integration/node/with_spec.rb
313
- - spec/integration/processor/tilde_spec.rb
314
- - spec/integration/processors_spec.rb
305
+ - spec/integration/node/each_spec.rb
306
+ - spec/integration/node/each_else_spec.rb
307
+ - spec/integration/node/helper_spec.rb
308
+ - spec/integration/node/path_spec.rb
309
+ - spec/integration/node/if_else_spec.rb
310
+ - spec/integration/comment_spec.rb
311
+ - spec/integration/cache_spec.rb
312
+ - spec/acceptance/collection_blocks_spec.rb
313
+ - spec/acceptance/global_helper_spec.rb
314
+ - spec/acceptance/application_layout_spec.rb