diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index fce9e1287..501a6835b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -11,6 +11,6 @@ def content_item_path .compact .join('.') - '/' + URI.encode(path_and_optional_locale) + '/' + URI.encode(path_and_optional_locale) # rubocop:disable Lint/UriEscapeUnescape end end diff --git a/app/controllers/content_items_controller.rb b/app/controllers/content_items_controller.rb index 9ccad31f1..a3d0eb42d 100644 --- a/app/controllers/content_items_controller.rb +++ b/app/controllers/content_items_controller.rb @@ -1,5 +1,4 @@ class ContentItemsController < ApplicationController - rescue_from GdsApi::HTTPForbidden, with: :error_403 rescue_from GdsApi::HTTPNotFound, with: :error_notfound rescue_from GdsApi::HTTPGone, with: :error_410 diff --git a/lib/helpers/document_types_helper.rb b/lib/helpers/document_types_helper.rb index 368b9bc64..32a673355 100644 --- a/lib/helpers/document_types_helper.rb +++ b/lib/helpers/document_types_helper.rb @@ -1,8 +1,8 @@ require 'rest-client' class DocumentTypesHelper - ALL_SEARCH_ENDPOINT = "https://www.gov.uk/api/search.json?facet_content_store_document_type=100,example_scope:global,examples:%{sample_size}&filter_rendering_app=government-frontend&count=0".freeze - SINGLE_SEARCH_ENDPOINT = "https://www.gov.uk/api/search.json?filter_content_store_document_type=%{document_type}&count=%{sample_size}".freeze + ALL_SEARCH_ENDPOINT = "https://www.gov.uk/api/search.json?facet_content_store_document_type=100,example_scope:global,examples:%s&filter_rendering_app=government-frontend&count=0".freeze + SINGLE_SEARCH_ENDPOINT = "https://www.gov.uk/api/search.json?filter_content_store_document_type=%s&count=%s".freeze def initialize(sample_size = 10) @sample_size = sample_size diff --git a/lib/helpers/wraith_config_helper.rb b/lib/helpers/wraith_config_helper.rb index 61a9d76fa..dab61c377 100644 --- a/lib/helpers/wraith_config_helper.rb +++ b/lib/helpers/wraith_config_helper.rb @@ -2,7 +2,7 @@ class WraithConfigHelper attr_accessor :name, :paths TEMPLATE_PATH = "test/wraith/config.yaml".freeze - OUTPUT_PATH = 'test/wraith/wip-config-%{suffix}.yaml'.freeze + OUTPUT_PATH = 'test/wraith/wip-config-%s.yaml'.freeze def initialize(name, paths) @name = name @@ -20,7 +20,7 @@ def create_config(extra_config = {}) private def load_template - YAML::load(File.open(TEMPLATE_PATH)) + YAML::safe_load(File.open(TEMPLATE_PATH)) end def build_paths diff --git a/test/presenters/content_item/shareable_test.rb b/test/presenters/content_item/shareable_test.rb index f653fc2af..6ebcfd07b 100644 --- a/test/presenters/content_item/shareable_test.rb +++ b/test/presenters/content_item/shareable_test.rb @@ -1,7 +1,8 @@ require 'test_helper' -include ERB::Util class ContentItemShareableTest < ActiveSupport::TestCase + include ERB::Util + class DummyContentItem include ContentItem::Shareable attr_accessor :content_item, :title diff --git a/test/presenters/travel_advice_presenter_test.rb b/test/presenters/travel_advice_presenter_test.rb index 0d849b0e0..4b940076e 100644 --- a/test/presenters/travel_advice_presenter_test.rb +++ b/test/presenters/travel_advice_presenter_test.rb @@ -83,9 +83,7 @@ def schema_name test "navigation items are presented as trackable links unless they are the current part" do example = schema_item("full-country") - base_path = example["base_path"] current_part = example["details"]["parts"].first - another_part = example["details"]["parts"][1] first_part_presented = presented_item("full-country", current_part["slug"]) navigation_items = first_part_presented.parts_navigation diff --git a/test/test_helper.rb b/test/test_helper.rb index 2abbc2f16..e14f64b9d 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -2,7 +2,7 @@ ENV['GOVUK_APP_DOMAIN'] = 'test.gov.uk' ENV['GOVUK_ASSET_ROOT'] = 'http://static.test.gov.uk' -require File.expand_path('../../config/environment', __FILE__) +require File.expand_path('../config/environment', __dir__) require 'rails/test_help' require 'capybara/rails' require 'mocha/minitest'