Skip to content

Commit

Permalink
add test for reproducing bug with rendering partial with locals (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
kortirso authored Jul 20, 2024
1 parent 8eaa418 commit 1e91b17
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions spec/extensions/partial_render_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,24 @@
])
end

it "renders an array with :locals" do
json = render(<<~PROPS)
emails = [
{value: '[email protected]'},
{value: '[email protected]'},
]
json.array! emails, partial: ['simple_as', locals: {}] do
end
PROPS

puts json.inspect

expect(json).to eql_json([
{foo: "[email protected]"},
{foo: "[email protected]"}
])
end

it "renders an an empty array" do
json = render(<<~PROPS)
json.array! [], {partial: 'simple'} do
Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/_simple_as.json.props
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
json.foo simple_as[:value]

0 comments on commit 1e91b17

Please sign in to comment.