Skip to content

Commit

Permalink
Update to Ruby 3.2.2
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mtaylorgds committed Dec 7, 2023
1 parent 6f6e186 commit 830c6cd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.2
3.2.2
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
6 changes: 2 additions & 4 deletions spec/lib/tasks/taxonomy/validate_taxons_base_paths_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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: #<GdsApi::HTTPUnprocessableEntity: URL: https://publishing-api.test.gov.uk/v2/content/CONTENT-ID-LEVEL-TWO
Response body:
{"error":{"code":422,"message":"base path=/transport conflicts with content_id=a4038b29-b332-4f13-98b1-1c9709e216bc and locale=en","fields":{"base":["base path=/transport conflicts with content_id=a4038b29-b332-4f13-98b1-1c9709e216bc and locale=en"]}}}>
CONTENT-ID-LEVEL-TWO /some-other-path/level-two: #<GdsApi::HTTPUnprocessableEntity:"URL: https://publishing-api.test.gov.uk/v2/content/CONTENT-ID-LEVEL-TWO\nResponse body:\n{\"error\":{\"code\":422,\"message\":\"base path=/transport conflicts with content_id=a4038b29-b332-4f13-98b1-1c9709e216bc and locale=en\",\"fields\":{\"base\":[\"base path=/transport conflicts with content_id=a4038b29-b332-4f13-98b1-1c9709e216bc and locale=en\"]}}}">
LOG
end

Expand Down

0 comments on commit 830c6cd

Please sign in to comment.