Merge pull request #2036 from Shopify/cp-fix-rubocop

Update the specs to new signature and fix CI
This commit is contained in:
CP Clermont
2026-01-14 09:14:01 -05:00
committed by GitHub
6 changed files with 16 additions and 19 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
name: Liquid name: Liquid
on: [push, pull_request] on: [push]
env: env:
BUNDLE_JOBS: 4 BUNDLE_JOBS: 4
@@ -32,7 +32,7 @@ jobs:
} }
- { ruby: head, allowed-failure: true, rubyopt: "--yjit" } - { ruby: head, allowed-failure: true, rubyopt: "--yjit" }
- { ruby: head, allowed-failure: true, rubyopt: "--zjit" } - { ruby: head, allowed-failure: true, rubyopt: "--zjit" }
name: Test Ruby ${{ matrix.entry.ruby }} name: Test Ruby ${{ matrix.entry.ruby }} ${{ matrix.entry.rubyopt }} --${{ matrix.entry.allowed-failure && 'allowed-failure' || 'strict' }}
steps: steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- uses: ruby/setup-ruby@a25f1e45f0e65a92fcb1e95e8847f78fb0a7197a # v1.273.0 - uses: ruby/setup-ruby@a25f1e45f0e65a92fcb1e95e8847f78fb0a7197a # v1.273.0
-1
View File
@@ -32,7 +32,6 @@ group :test do
end end
group :spec do group :spec do
# Using feature branch until https://github.com/Shopify/liquid-spec/pull/97 is merged
gem 'liquid-spec', github: 'Shopify/liquid-spec', branch: 'main' gem 'liquid-spec', github: 'Shopify/liquid-spec', branch: 'main'
gem 'activesupport', require: false gem 'activesupport', require: false
end end
+4 -5
View File
@@ -14,15 +14,14 @@ end
# Compile a template string into a Liquid::Template # Compile a template string into a Liquid::Template
LiquidSpec.compile do |ctx, source, options| LiquidSpec.compile do |ctx, source, options|
Liquid::Template.parse(source, **options) ctx[:template] = Liquid::Template.parse(source, **options)
end end
# Render a compiled template with the given context # Render a compiled template with the given context
# @param ctx [Hash] adapter context (unused) # @param ctx [Hash] adapter context containing :template
# @param template [Liquid::Template] compiled template
# @param assigns [Hash] environment variables # @param assigns [Hash] environment variables
# @param options [Hash] :registers, :strict_errors, :exception_renderer # @param options [Hash] :registers, :strict_errors, :exception_renderer
LiquidSpec.render do |ctx, template, assigns, options| LiquidSpec.render do |ctx, assigns, options|
registers = Liquid::Registers.new(options[:registers] || {}) registers = Liquid::Registers.new(options[:registers] || {})
context = Liquid::Context.build( context = Liquid::Context.build(
@@ -33,5 +32,5 @@ LiquidSpec.render do |ctx, template, assigns, options|
context.exception_renderer = options[:exception_renderer] if options[:exception_renderer] context.exception_renderer = options[:exception_renderer] if options[:exception_renderer]
template.render(context) ctx[:template].render(context)
end end
+3 -3
View File
@@ -15,11 +15,11 @@ end
LiquidSpec.compile do |ctx, source, options| LiquidSpec.compile do |ctx, source, options|
# Force lax mode # Force lax mode
options = options.merge(error_mode: :lax) options = options.merge(error_mode: :lax)
Liquid::Template.parse(source, **options) ctx[:template] = Liquid::Template.parse(source, **options)
end end
# Render a compiled template with the given context # Render a compiled template with the given context
LiquidSpec.render do |ctx, template, assigns, options| LiquidSpec.render do |ctx, assigns, options|
registers = Liquid::Registers.new(options[:registers] || {}) registers = Liquid::Registers.new(options[:registers] || {})
context = Liquid::Context.build( context = Liquid::Context.build(
@@ -30,5 +30,5 @@ LiquidSpec.render do |ctx, template, assigns, options|
context.exception_renderer = options[:exception_renderer] if options[:exception_renderer] context.exception_renderer = options[:exception_renderer] if options[:exception_renderer]
template.render(context) ctx[:template].render(context)
end end
+4 -5
View File
@@ -15,15 +15,14 @@ end
# Compile a template string into a Liquid::Template # Compile a template string into a Liquid::Template
LiquidSpec.compile do |ctx, source, options| LiquidSpec.compile do |ctx, source, options|
Liquid::Template.parse(source, **options) ctx[:template] = Liquid::Template.parse(source, **options)
end end
# Render a compiled template with the given context # Render a compiled template with the given context
# @param ctx [Hash] adapter context (unused) # @param ctx [Hash] adapter context containing :template
# @param template [Liquid::Template] compiled template
# @param assigns [Hash] environment variables # @param assigns [Hash] environment variables
# @param options [Hash] :registers, :strict_errors, :exception_renderer # @param options [Hash] :registers, :strict_errors, :exception_renderer
LiquidSpec.render do |ctx, template, assigns, options| LiquidSpec.render do |ctx, assigns, options|
registers = Liquid::Registers.new(options[:registers] || {}) registers = Liquid::Registers.new(options[:registers] || {})
context = Liquid::Context.build( context = Liquid::Context.build(
@@ -34,5 +33,5 @@ LiquidSpec.render do |ctx, template, assigns, options|
context.exception_renderer = options[:exception_renderer] if options[:exception_renderer] context.exception_renderer = options[:exception_renderer] if options[:exception_renderer]
template.render(context) ctx[:template].render(context)
end end
+3 -3
View File
@@ -22,11 +22,11 @@ end
LiquidSpec.compile do |ctx, source, options| LiquidSpec.compile do |ctx, source, options|
# Force strict mode # Force strict mode
options = { error_mode: :strict }.merge(options) options = { error_mode: :strict }.merge(options)
Liquid::Template.parse(source, **options) ctx[:template] = Liquid::Template.parse(source, **options)
end end
# Render a compiled template with the given context # Render a compiled template with the given context
LiquidSpec.render do |ctx, template, assigns, options| LiquidSpec.render do |ctx, assigns, options|
registers = Liquid::Registers.new(options[:registers] || {}) registers = Liquid::Registers.new(options[:registers] || {})
context = Liquid::Context.build( context = Liquid::Context.build(
@@ -37,5 +37,5 @@ LiquidSpec.render do |ctx, template, assigns, options|
context.exception_renderer = options[:exception_renderer] if options[:exception_renderer] context.exception_renderer = options[:exception_renderer] if options[:exception_renderer]
template.render(context) ctx[:template].render(context)
end end