Skip to content

Commit

Permalink
Add explicit require where OpenStruct is used
Browse files Browse the repository at this point in the history
`OpenStruct` is used by `MockMessage` to represent a message's headers
and delivery information, but the file does not actually require the
`ostruct` library which provides this type.

Many of our projects will somehow transitively require it anyway as it's
extensively used in Ruby, so this omission hasn't caused issues so far,
but we've encountered a problem on `search-api-v2` now where a
completely unrelated dependency was updated and no longer uses
`ostruct`, causing tests that use `MockMessage` to fail as the library
is no longer loaded.
  • Loading branch information
csutter committed May 17, 2024
1 parent 23cf5ec commit 13bf1b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Unreleased
- Add explicit require for `ostruct` library to `MockMessage` (previously relied on `ostruct` being
required somewhere in consuming code)

# 5.0.0

- BREAKING: remove disused support for statsd. No clients in alphagov use the statsd functionality any more, so this is only theoretically breaking.
Expand Down
2 changes: 2 additions & 0 deletions lib/govuk_message_queue_consumer/test_helpers/mock_message.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require "ostruct"

module GovukMessageQueueConsumer
class MockMessage < Message
attr_reader :acked, :retried, :discarded, :payload, :header, :delivery_info
Expand Down

0 comments on commit 13bf1b1

Please sign in to comment.