Skip to content

Commit

Permalink
Add warning message for supplemental content
Browse files Browse the repository at this point in the history
Refs #445
  • Loading branch information
peteryates committed Jan 28, 2024
1 parent 07004fa commit 8d27380
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ def initialize(builder, object_name, attribute_name, content)
def html
return if @content.blank?

warn("Supplemental content is deprecated and support will soon be removed. See https://github.com/x-govuk/govuk-form-builder/issues/445")

tag.div(id: supplemental_id) { @content }
end

Expand Down
9 changes: 9 additions & 0 deletions spec/support/shared/shared_block_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@
with_tag('p', text: block_p)
end
end

describe "deprecation warning message" do
before { allow(Rails).to receive_message_chain(:logger, :warn).with(any_args).and_return(true) }

specify 'logs a deprecation warning' do
subject
expect(Rails.logger).to have_received(:warn).with(/Supplemental content is deprecated/)
end
end
end

context 'when no block is supplied' do
Expand Down

0 comments on commit 8d27380

Please sign in to comment.