From dbc5dca63567ed3ed70838650108ac1c003ab9d9 Mon Sep 17 00:00:00 2001 From: Celia Collins Date: Fri, 7 Aug 2020 15:36:11 +0100 Subject: [PATCH 1/3] Fix deprecation of keyword arguments Splitting the last argument into positional and keyword parameters is deprecated --- app/helpers/application_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e7ca95305..274bdd347 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -4,9 +4,9 @@ def page_text_direction end def t_locale_fallback(key, options = {}) - options["locale"] = I18n.locale + options[:locale] = I18n.locale options[:fallback] = nil - translation = I18n.t(key, options) + translation = I18n.t(key, **options) if translation.nil? || translation.include?("translation missing") I18n.default_locale From a970a5a9a6857ba6ee29462313357e2d89292cf5 Mon Sep 17 00:00:00 2001 From: Celia Collins Date: Mon, 10 Aug 2020 09:52:27 +0100 Subject: [PATCH 2/3] Remove obsolete URI.escape Ruby 2.7 shows a warning for this obsolete method, which has actually been obsolete for over 10 years now. This alternative method encodes `/` as well, so need to substitute those back in. --- app/controllers/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e9b831c96..41e929d77 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -18,6 +18,6 @@ def content_item_path .compact .join(".") - "/" + URI.encode(path_and_optional_locale) # rubocop:disable Lint/UriEscapeUnescape + "/" + URI.encode_www_form_component(path_and_optional_locale).gsub("%2F", "/") end end From bcd5de81db581bb237aba095447ef0f8f0820a37 Mon Sep 17 00:00:00 2001 From: Celia Collins Date: Mon, 10 Aug 2020 10:13:03 +0100 Subject: [PATCH 3/3] Remove Ruby version from Gemfile.lock and update gems for 2.7.1 It's better to have the version of Ruby stored in just one place --- Gemfile | 2 -- Gemfile.lock | 15 ++++++--------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/Gemfile b/Gemfile index c08d372a5..0f15ad8c2 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,5 @@ source "https://rubygems.org" -ruby File.read(".ruby-version").strip - gem "rails", "6.0.3.3" gem "dalli" diff --git a/Gemfile.lock b/Gemfile.lock index 1a6ed3100..9dd8fb63e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -71,7 +71,7 @@ GEM rack (>= 0.9.0) binding_of_caller (0.8.0) debug_inspector (>= 0.0.1) - brakeman (4.8.2) + brakeman (4.9.1) builder (3.2.4) capybara (3.33.0) addressable @@ -137,7 +137,7 @@ GEM domain_name (~> 0.5) i18n (1.8.5) concurrent-ruby (~> 1.0) - image_size (2.0.2) + image_size (2.1.0) io-like (0.3.1) jasmine (3.6.0) jasmine-core (~> 3.6.0) @@ -197,8 +197,8 @@ GEM pry (0.13.1) coderay (~> 1.1) method_source (~> 1.0) - public_suffix (4.0.5) - puma (4.3.5) + public_suffix (4.0.6) + puma (4.3.6) nio4r (~> 2.0) rack (2.2.3) rack-test (1.1.0) @@ -266,8 +266,8 @@ GEM rubocop-ast (>= 0.1.0, < 1.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (0.2.0) - parser (>= 2.7.0.1) + rubocop-ast (0.3.0) + parser (>= 2.7.1.4) rubocop-govuk (3.17.0) rubocop (= 0.87.1) rubocop-rails (= 2.6.0) @@ -400,8 +400,5 @@ DEPENDENCIES webmock wraith -RUBY VERSION - ruby 2.6.6 - BUNDLED WITH 1.17.3