Added container settings registration

Necessary to provide application wide access to the configuration which will soon be shared by the newly renamed requester and client (not implemented yet).

Milestone: minor
This commit is contained in:
Brooke Kuhlmann
2025-05-05 17:00:55 -06:00
parent 25086e5594
commit 175795b2b2
2 changed files with 11 additions and 2 deletions
+1
View File
@@ -10,6 +10,7 @@ module TRMNL
module Container
extend Containable
register(:settings) { TRMNL::API::Configuration::Loader.new.call }
register(:requester) { API::Requester.new }
register(:logger) { Cogger.new id: "trmnl-api", formatter: :json }
@@ -1,9 +1,17 @@
# frozen_string_literal: true
RSpec.shared_context "with application dependencies" do
let(:logger) { Cogger.new id: "trmnl-api", io: StringIO.new, level: :debug }
let :settings do
TRMNL::API::Configuration::Content[
content_type: "application/json",
uri: "https://trmnl.app/api"
]
end
before { TRMNL::API::Container.stub! http:, logger: }
let(:logger) { Cogger.new id: "trmnl-api", io: StringIO.new, level: :debug }
let(:http) { class_spy HTTP }
before { TRMNL::API::Container.stub! settings:, http:, logger: }
after { TRMNL::API::Container.restore }
end