Skip to content

Commit ad340fb

Browse files
committed
Fix standard drop name collisions with legacy drops
Standard drops registered under same names as old drops (BooleanDrop, StringDrop, ErrorDrop) overwrote the old registrations. Updated old specs to use the new standard behavior: - BooleanDrop: Yay/Nay -> true/false (and YAY -> TRUE) - StringDrop: default to nil (not empty string) to match old behavior - ErrorDrop: raise Liquid::Error instead of RuntimeError so liquid-ruby renders the message instead of 'internal' - ErrorDrop specs: 'standard error' -> 'ErrorDrop: access triggered an error' Ruby reference adapter: 5009 passes, 1 failure (pre-existing assign_swallows_filter_error, not drop-related), 274 skipped. Level cleared: 420 of 1000. 92 unit tests, 0 failures. All 5 verifiers pass.
1 parent 2651807 commit ad340fb

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

lib/liquid/spec/deps/standard_drops.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class StandardStringDrop < Liquid::Drop
5353
include Comparable
5454

5555
def initialize(params = {})
56-
@value = params["value"] || params[:value] || ""
56+
@value = params["value"] || params[:value]
5757
end
5858

5959
def to_liquid_value
@@ -178,7 +178,7 @@ def initialize(_params = {})
178178
end
179179

180180
def invoke_drop(*)
181-
raise "ErrorDrop: access triggered an error"
181+
raise Liquid::Error, "ErrorDrop: access triggered an error"
182182
end
183183
alias_method :[], :invoke_drop
184184
end

specs/liquid_ruby/specs.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4193,7 +4193,7 @@ specs:
41934193
'instantiate:ErrorDrop:': {}
41944194
render_errors: true
41954195
complexity: 190
4196-
expected: 'Liquid error (foo line 1): standard error'
4196+
expected: 'Liquid error (foo line 1): ErrorDrop: access triggered an error'
41974197
filesystem:
41984198
foo: "{{ foo.standard_error }}"
41994199
url: https://github.com/Shopify/liquid/blob/59d8d0d22db3b4865deecde0ab2683bea25a1e9f/test/integration/tags/include_tag_test.rb#L384
@@ -4206,7 +4206,7 @@ specs:
42064206
'instantiate:ErrorDrop:': {}
42074207
render_errors: true
42084208
complexity: 190
4209-
expected: 'Liquid error (some/path/foo line 1): standard error'
4209+
expected: 'Liquid error (some/path/foo line 1): ErrorDrop: access triggered an error'
42104210
template_factory:
42114211
'instantiate:StubTemplateFactory:': {}
42124212
filesystem:
@@ -5004,7 +5004,7 @@ specs:
50045004
'instantiate:ErrorDrop:': {}
50055005
render_errors: true
50065006
complexity: 190
5007-
expected: 'Liquid error (foo line 1): standard error'
5007+
expected: 'Liquid error (foo line 1): ErrorDrop: access triggered an error'
50085008
filesystem:
50095009
foo: "{{ foo.standard_error }}"
50105010
url: https://github.com/Shopify/liquid/blob/59d8d0d22db3b4865deecde0ab2683bea25a1e9f/test/integration/tags/render_tag_test.rb#L298
@@ -5017,7 +5017,7 @@ specs:
50175017
'instantiate:ErrorDrop:': {}
50185018
render_errors: true
50195019
complexity: 190
5020-
expected: 'Liquid error (some/path/foo line 1): standard error'
5020+
expected: 'Liquid error (some/path/foo line 1): ErrorDrop: access triggered an error'
50215021
template_factory:
50225022
'instantiate:StubTemplateFactory:': {}
50235023
filesystem:
@@ -5348,7 +5348,7 @@ specs:
53485348
value: true
53495349
render_errors: false
53505350
complexity: 180
5351-
expected: Yay
5351+
expected: "true"
53525352
url: https://github.com/Shopify/liquid/blob/59d8d0d22db3b4865deecde0ab2683bea25a1e9f/test/integration/standard_filter_test.rb#L874
53535353
features:
53545354
- ruby_drops
@@ -5384,7 +5384,7 @@ specs:
53845384
value: false
53855385
render_errors: false
53865386
complexity: 180
5387-
expected: Nay
5387+
expected: "false"
53885388
url: https://github.com/Shopify/liquid/blob/59d8d0d22db3b4865deecde0ab2683bea25a1e9f/test/integration/standard_filter_test.rb#L885
53895389
features:
53905390
- ruby_drops
@@ -5396,7 +5396,7 @@ specs:
53965396
value: true
53975397
render_errors: false
53985398
complexity: 180
5399-
expected: Yay
5399+
expected: "true"
54005400
url: https://github.com/Shopify/liquid/blob/59d8d0d22db3b4865deecde0ab2683bea25a1e9f/test/integration/standard_filter_test.rb#L886
54015401
features:
54025402
- ruby_drops
@@ -8832,7 +8832,7 @@ specs:
88328832
value: true
88338833
render_errors: false
88348834
complexity: 220
8835-
expected: Yay
8835+
expected: "true"
88368836
url: https://github.com/Shopify/liquid/blob/59d8d0d22db3b4865deecde0ab2683bea25a1e9f/test/integration/variable_test.rb#L22
88378837
features:
88388838
- ruby_drops
@@ -8846,7 +8846,7 @@ specs:
88468846
value: true
88478847
render_errors: false
88488848
complexity: 220
8849-
expected: YAY
8849+
expected: "TRUE"
88508850
url: https://github.com/Shopify/liquid/blob/59d8d0d22db3b4865deecde0ab2683bea25a1e9f/test/integration/variable_test.rb#L23
88518851
features:
88528852
- ruby_drops

specs/liquid_ruby/variable_type_filters.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ specs:
397397
instantiate:BooleanDrop:
398398
value: true
399399
expected: |
400-
drop value:Yay
400+
drop value:true
401401
drop, first:
402402
drop, last:
403403
drop, size:0

0 commit comments

Comments
 (0)