Skip to content

Commit

Permalink
Merge pull request #42 from alphagov/structure
Browse files Browse the repository at this point in the history
Improve application structure further
  • Loading branch information
csutter authored Oct 6, 2023
2 parents 36a5905 + dfe7417 commit 882da03
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module SearchRepositories
module Repositories
module Null
# A repository that does nothing other than logging out any received calls, for use until we can
# integrate with the real product.
class NullRepository
class Repository
def initialize(logger: Logger.new($stdout, progname: self.class.name))
@logger = logger
end
Expand Down
4 changes: 2 additions & 2 deletions lib/tasks/document_sync_worker.rake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require "document_sync_worker"
require "search_repositories/null/null_repository"
require "repositories/null/repository"

# TODO: For now, this lives within the application repository, but we may want to extract it to a
# completely separate unit if we can keep dependencies between the read and write sides of this
Expand Down Expand Up @@ -29,7 +29,7 @@ namespace :document_sync_worker do
# TODO: Once we have access to the search product and written a repository for it, this should
# be set to the real repository. Until then, this allows us to verify that the pipeline is
# working as expected through the logs.
config.repository = SearchRepositories::Null::NullRepository.new
config.repository = Repositories::Null::Repository.new
config.message_queue_name = ENV.fetch("PUBLISHED_DOCUMENTS_MESSAGE_QUEUE_NAME")
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require "govuk_message_queue_consumer"
require "govuk_message_queue_consumer/test_helpers"

RSpec.describe "Publishing event pipeline" do
RSpec.describe "Document sync worker end-to-end" do
let(:repository) { DocumentSyncWorker::Repositories::TestRepository.new(documents) }
let(:message) { GovukMessageQueueConsumer::MockMessage.new(payload) }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "search_repositories/null/null_repository"
require "repositories/null/repository"

RSpec.describe SearchRepositories::Null::NullRepository do
RSpec.describe Repositories::Null::Repository do
let(:repository) { described_class.new(logger:) }
let(:logger) { instance_double(Logger, info: nil) }

Expand Down

0 comments on commit 882da03

Please sign in to comment.