mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-17 04:34:24 +00:00
Do not notify Bugsnag of a cache miss
It's not the responsibility of a error tracking software to track neither cache misses nor logs. That is what log monitoring is for.
This commit is contained in:
@@ -77,11 +77,6 @@ module OpenFoodNetwork
|
||||
cpr.products_json
|
||||
expect(cached_json).to eq 'fresh products'
|
||||
end
|
||||
|
||||
it "logs a warning" do
|
||||
cpr.should_receive :log_warning
|
||||
cpr.products_json
|
||||
end
|
||||
end
|
||||
|
||||
describe "when there are no products" do
|
||||
@@ -104,34 +99,9 @@ module OpenFoodNetwork
|
||||
expect(cache_present).to be
|
||||
expect(cached_json).to be_nil
|
||||
end
|
||||
|
||||
it "logs a warning" do
|
||||
cpr.should_receive :log_warning
|
||||
expect { cpr.products_json }.to raise_error CachedProductsRenderer::NoProducts
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "logging a warning" do
|
||||
it "logs a warning when in production" do
|
||||
Rails.env.stub(:production?) { true }
|
||||
expect(Bugsnag).to receive(:notify)
|
||||
cpr.send(:log_warning)
|
||||
end
|
||||
|
||||
it "logs a warning when in staging" do
|
||||
Rails.env.stub(:production?) { false }
|
||||
Rails.env.stub(:staging?) { true }
|
||||
expect(Bugsnag).to receive(:notify)
|
||||
cpr.send(:log_warning)
|
||||
end
|
||||
|
||||
it "does not log a warning in development or test" do
|
||||
expect(Bugsnag).to receive(:notify).never
|
||||
cpr.send(:log_warning)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user