diff --git a/app/components/govuk_component/tab_component.rb b/app/components/govuk_component/tab_component.rb index 1ac03dd6..8dc22500 100644 --- a/app/components/govuk_component/tab_component.rb +++ b/app/components/govuk_component/tab_component.rb @@ -23,7 +23,7 @@ class Tab < GovukComponent::Base def initialize(label:, text: nil, classes: [], html_attributes: {}) @label = label - @text = text + @text = h(text) super(classes: classes, html_attributes: html_attributes) end diff --git a/govuk-components.gemspec b/govuk-components.gemspec index 41e0f836..39f3c0c4 100644 --- a/govuk-components.gemspec +++ b/govuk-components.gemspec @@ -24,7 +24,7 @@ Gem::Specification.new do |spec| spec.add_dependency("html-attributes-utils", "~> 1.0.0", ">= 1.0.0") spec.add_dependency("pagy", "~> 6.0") - spec.add_dependency("view_component", ">= 3.3", "< 3.9") + spec.add_dependency("view_component", ">= 3.9", "< 3.10") spec.add_development_dependency "deep_merge" spec.add_development_dependency "pry-byebug" diff --git a/guide/lib/examples/pagination_helpers.rb b/guide/lib/examples/pagination_helpers.rb index f2a24e56..98d1ce63 100644 --- a/guide/lib/examples/pagination_helpers.rb +++ b/guide/lib/examples/pagination_helpers.rb @@ -4,7 +4,7 @@ # links expect a Rack request. module Pagy::UrlHelpers def request - OpenStruct.new(GET: {}, session: nil, host: "https://somesite/") + OpenStruct.new(GET: {}, session: nil, host: "https://somesite/", format: OpenStruct.new(html?: true)) end end diff --git a/spec/components/govuk_component/header_component_spec.rb b/spec/components/govuk_component/header_component_spec.rb index 565ea7cd..0c4a0c55 100644 --- a/spec/components/govuk_component/header_component_spec.rb +++ b/spec/components/govuk_component/header_component_spec.rb @@ -3,7 +3,9 @@ RSpec.describe(GovukComponent::HeaderComponent, type: :component) do before do allow_any_instance_of(GovukComponent::HeaderComponent::NavigationItem).to( - receive(:request).and_return(double(ActionDispatch::Request, get?: true, path: current_page)) + receive(:current_page?).and_wrap_original do |_original_method, path| + path == current_page + end ) end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f01e02bf..b132cd45 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -21,7 +21,7 @@ module Pagy::UrlHelpers def request - OpenStruct.new(GET: {}, session: nil, host: "https://somesite/") + OpenStruct.new(GET: {}, session: nil, host: "https://somesite/", format: OpenStruct.new(html?: true)) end end