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 Dec 9, 2023
1 parent 349383e commit 6c4b545
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?

Rails.logger.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 6c4b545

Please sign in to comment.