From 830c6cd281e3ed3717a22f7a6bf9a06d5c6350c1 Mon Sep 17 00:00:00 2001 From: Mark Taylor <138604938+mtaylorgds@users.noreply.github.com> Date: Wed, 6 Dec 2023 14:20:50 +0000 Subject: [PATCH] Update to Ruby 3.2.2 There has been a change in how Ruby prints errors, which seems to have impacted a test that was checking stdout. The Ruby change discussion talks about printing unhandled errors, and in our case we're printing the results of an exception's `#inspect` method in a `rescue` block, but it seems too closely-related to be a coincidence. Aside from making the output go all on a single line (so the newlines in the HEREDOC were being removed), the escape sequences were being double-escaped (so every `\"` became `\\"`). Putting single-quotes around the opening identifier avoids this issue. Ruby language change discussion: https://bugs.ruby-lang.org/issues/18367 --- .ruby-version | 2 +- Dockerfile | 2 +- spec/lib/tasks/taxonomy/validate_taxons_base_paths_spec.rb | 6 ++---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.ruby-version b/.ruby-version index ef538c281..be94e6f53 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.1.2 +3.2.2 diff --git a/Dockerfile b/Dockerfile index bb755bae4..95ec88183 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG ruby_version=3.1.2 +ARG ruby_version=3.2.2 ARG base_image=ghcr.io/alphagov/govuk-ruby-base:$ruby_version ARG builder_image=ghcr.io/alphagov/govuk-ruby-builder:$ruby_version diff --git a/spec/lib/tasks/taxonomy/validate_taxons_base_paths_spec.rb b/spec/lib/tasks/taxonomy/validate_taxons_base_paths_spec.rb index 6be6c19a1..0a02245da 100644 --- a/spec/lib/tasks/taxonomy/validate_taxons_base_paths_spec.rb +++ b/spec/lib/tasks/taxonomy/validate_taxons_base_paths_spec.rb @@ -145,14 +145,12 @@ travel_to "2018-02-28T16:23:32+00:00" do rake "taxonomy:validate_taxons_base_paths", "and_fix" end - }.to output(<<~LOG).to_stdout_from_any_process + }.to output(<<~'LOG').to_stdout_from_any_process ✅ /level-one ❌ ├── /some-other-path/level-two ------------------------------------ The following taxons did not match the taxon URL structure. Attempting to fix this... - CONTENT-ID-LEVEL-TWO /some-other-path/level-two: # + CONTENT-ID-LEVEL-TWO /some-other-path/level-two: # LOG end