Skip to content

Commit d321ada

Browse files
committed
Fix spec adapter for liquid-spec API (template, assigns, options)
1 parent 53641e1 commit d321ada

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

spec/ruby_liquid.rb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,19 @@
1818
end
1919

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

2527
context = Liquid::Context.build(
26-
static_environments: ctx.environment,
28+
static_environments: assigns,
2729
registers: registers,
28-
rethrow_errors: ctx.rethrow_errors?,
30+
rethrow_errors: options[:strict_errors],
2931
)
3032

31-
context.exception_renderer = ctx.exception_renderer if ctx.exception_renderer
33+
context.exception_renderer = options[:exception_renderer] if options[:exception_renderer]
3234

3335
template.render(context)
3436
end

0 commit comments

Comments
 (0)