Skip to content

Commit d897899

Browse files
authored
Merge pull request #2036 from Shopify/cp-fix-rubocop
Update the specs to new signature and fix CI
2 parents eaa9f21 + aa817c4 commit d897899

6 files changed

Lines changed: 16 additions & 19 deletions

File tree

.github/workflows/liquid.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Liquid
2-
on: [push, pull_request]
2+
on: [push]
33

44
env:
55
BUNDLE_JOBS: 4
@@ -32,7 +32,7 @@ jobs:
3232
}
3333
- { ruby: head, allowed-failure: true, rubyopt: "--yjit" }
3434
- { ruby: head, allowed-failure: true, rubyopt: "--zjit" }
35-
name: Test Ruby ${{ matrix.entry.ruby }}
35+
name: Test Ruby ${{ matrix.entry.ruby }} ${{ matrix.entry.rubyopt }} --${{ matrix.entry.allowed-failure && 'allowed-failure' || 'strict' }}
3636
steps:
3737
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
3838
- uses: ruby/setup-ruby@a25f1e45f0e65a92fcb1e95e8847f78fb0a7197a # v1.273.0

Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ group :test do
3232
end
3333

3434
group :spec do
35-
# Using feature branch until https://github.com/Shopify/liquid-spec/pull/97 is merged
3635
gem 'liquid-spec', github: 'Shopify/liquid-spec', branch: 'main'
3736
gem 'activesupport', require: false
3837
end

spec/ruby_liquid.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,14 @@
1414

1515
# Compile a template string into a Liquid::Template
1616
LiquidSpec.compile do |ctx, source, options|
17-
Liquid::Template.parse(source, **options)
17+
ctx[:template] = Liquid::Template.parse(source, **options)
1818
end
1919

2020
# Render a compiled template with the given context
21-
# @param ctx [Hash] adapter context (unused)
22-
# @param template [Liquid::Template] compiled template
21+
# @param ctx [Hash] adapter context containing :template
2322
# @param assigns [Hash] environment variables
2423
# @param options [Hash] :registers, :strict_errors, :exception_renderer
25-
LiquidSpec.render do |ctx, template, assigns, options|
24+
LiquidSpec.render do |ctx, assigns, options|
2625
registers = Liquid::Registers.new(options[:registers] || {})
2726

2827
context = Liquid::Context.build(
@@ -33,5 +32,5 @@
3332

3433
context.exception_renderer = options[:exception_renderer] if options[:exception_renderer]
3534

36-
template.render(context)
35+
ctx[:template].render(context)
3736
end

spec/ruby_liquid_lax.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
LiquidSpec.compile do |ctx, source, options|
1616
# Force lax mode
1717
options = options.merge(error_mode: :lax)
18-
Liquid::Template.parse(source, **options)
18+
ctx[:template] = Liquid::Template.parse(source, **options)
1919
end
2020

2121
# Render a compiled template with the given context
22-
LiquidSpec.render do |ctx, template, assigns, options|
22+
LiquidSpec.render do |ctx, assigns, options|
2323
registers = Liquid::Registers.new(options[:registers] || {})
2424

2525
context = Liquid::Context.build(
@@ -30,5 +30,5 @@
3030

3131
context.exception_renderer = options[:exception_renderer] if options[:exception_renderer]
3232

33-
template.render(context)
33+
ctx[:template].render(context)
3434
end

spec/ruby_liquid_with_active_support.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,14 @@
1515

1616
# Compile a template string into a Liquid::Template
1717
LiquidSpec.compile do |ctx, source, options|
18-
Liquid::Template.parse(source, **options)
18+
ctx[:template] = Liquid::Template.parse(source, **options)
1919
end
2020

2121
# Render a compiled template with the given context
22-
# @param ctx [Hash] adapter context (unused)
23-
# @param template [Liquid::Template] compiled template
22+
# @param ctx [Hash] adapter context containing :template
2423
# @param assigns [Hash] environment variables
2524
# @param options [Hash] :registers, :strict_errors, :exception_renderer
26-
LiquidSpec.render do |ctx, template, assigns, options|
25+
LiquidSpec.render do |ctx, assigns, options|
2726
registers = Liquid::Registers.new(options[:registers] || {})
2827

2928
context = Liquid::Context.build(
@@ -34,5 +33,5 @@
3433

3534
context.exception_renderer = options[:exception_renderer] if options[:exception_renderer]
3635

37-
template.render(context)
36+
ctx[:template].render(context)
3837
end

spec/ruby_liquid_yjit.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
LiquidSpec.compile do |ctx, source, options|
2323
# Force strict mode
2424
options = { error_mode: :strict }.merge(options)
25-
Liquid::Template.parse(source, **options)
25+
ctx[:template] = Liquid::Template.parse(source, **options)
2626
end
2727

2828
# Render a compiled template with the given context
29-
LiquidSpec.render do |ctx, template, assigns, options|
29+
LiquidSpec.render do |ctx, assigns, options|
3030
registers = Liquid::Registers.new(options[:registers] || {})
3131

3232
context = Liquid::Context.build(
@@ -37,5 +37,5 @@
3737

3838
context.exception_renderer = options[:exception_renderer] if options[:exception_renderer]
3939

40-
template.render(context)
40+
ctx[:template].render(context)
4141
end

0 commit comments

Comments
 (0)