Skip to content

Commit

Permalink
Merge pull request #2128 from tf/additional-seed-req
Browse files Browse the repository at this point in the history
Pass real request object to additional seed callable
  • Loading branch information
tf authored Jul 15, 2024
2 parents 6d30314 + cc98cdd commit 7ed0519
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ json.config do
entry_config
.additional_frontend_seed_data
.for(entry,
self,
request,
include_unused: options[:include_unused_additional_seed_data])
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,29 @@ def render(helper, entry, options = {})
})
end

it 'passes request to seed callable' do
pageflow_configure do |config|
config.for_entry_type(PageflowScrolled.entry_type) do |entry_type_config|
entry_type_config.additional_frontend_seed_data.register(
'someSeed',
proc { |request:, **| {some: request.original_url} }
)
end
end

entry = create(:published_entry, type_name: 'scrolled')

result = render(helper, entry)

expect(result).to include_json(config: {
additionalSeedData: {
someSeed: {
some: 'http://test.host'
}
}
})
end

context 'consent vendors' do
include_context 'fake translations'

Expand Down

0 comments on commit 7ed0519

Please sign in to comment.