Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add warning message for supplemental content #456

Merged
merged 2 commits into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions guide/lib/helpers.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
require 'pry'
require 'rails'
require 'action_view'
require 'active_model'
require 'active_support/core_ext/string'
require 'htmlbeautifier'
require 'slim/erb_converter'

Rails.logger = Logger.new($stdout)

Dir.glob(File.join('./lib', '**', '*.rb')).sort.each { |f| require f }

$LOAD_PATH.unshift(File.expand_path("../../lib", "lib"))
Expand Down
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
Loading