Skip to content

Commit

Permalink
Fix warn log test.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Feb 1, 2025
1 parent f392d30 commit 7cd21c5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
2 changes: 0 additions & 2 deletions gems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
gem "decode"
gem "rubocop"

gem "sus-fixtures-console"

gem "bake-test"
gem "bake-test-external"
end
2 changes: 1 addition & 1 deletion lib/metrics/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def require_backend(env = ENV)
if backend = env["METRICS_BACKEND"]
begin
if require(backend)
Metrics.extend(Backend::Interface)
Metrics.singleton_class.prepend(Backend::Interface)

return true
end
Expand Down
10 changes: 2 additions & 8 deletions test/metrics/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,16 @@
require "metrics/config"
require "json"

require "sus/fixtures/console"

describe Metrics::Config do
let(:config) {subject.default}

with ".require_backend" do
include_context Sus::Fixtures::Console::CapturedLogger

it "logs a warning if backend cannot be loaded" do
expect(config).to receive(:warn).and_return(nil)

expect(
config.require_backend({"METRICS_BACKEND" => "metrics/backend/missing"})
).to be == false

expect_console.to have_logged(
severity: be == :warn,
)
end
end
end

0 comments on commit 7cd21c5

Please sign in to comment.