mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-16 04:24:23 +00:00
Merge pull request #13141 from mkllnk/dfc-error-logging
Report DFC server errors to Bugsnag
This commit is contained in:
@@ -7,16 +7,16 @@ RSpec.describe Alert do
|
||||
original_config = nil
|
||||
Bugsnag.configure do |config|
|
||||
original_config = config.dup
|
||||
config.api_key ||= "dummy-key"
|
||||
config.notify_release_stages = ["test"]
|
||||
config.api_key ||= "00000000000000000000000000000000"
|
||||
config.enabled_release_stages = ["test"]
|
||||
config.delivery_method = :synchronous
|
||||
end
|
||||
|
||||
example.run
|
||||
|
||||
Bugsnag.configure do |config|
|
||||
config.api_key ||= original_config.api_key
|
||||
config.notify_release_stages = original_config.notify_release_stages
|
||||
config.api_key = original_config.api_key
|
||||
config.enabled_release_stages = original_config.notify_release_stages
|
||||
config.delivery_method = original_config.delivery_method
|
||||
end
|
||||
end
|
||||
@@ -28,8 +28,6 @@ RSpec.describe Alert do
|
||||
end
|
||||
|
||||
it "adds context" do
|
||||
pending "Bugsnag calls in CI" if ENV.fetch("CI", false)
|
||||
|
||||
expect_any_instance_of(Bugsnag::Report).to receive(:add_metadata).with(
|
||||
:order, { number: "ABC123" }
|
||||
)
|
||||
@@ -43,9 +41,23 @@ RSpec.describe Alert do
|
||||
)
|
||||
end
|
||||
|
||||
it "is compatible with Bugsnag API" do
|
||||
pending "Bugsnag calls in CI" if ENV.fetch("CI", false)
|
||||
it "adds context given as keyword argument" do
|
||||
expect_any_instance_of(Bugsnag::Report).to receive(:add_metadata).with(
|
||||
:thing, { data: "ABC123" }
|
||||
)
|
||||
|
||||
Alert.raise("hey", thing: "ABC123")
|
||||
end
|
||||
|
||||
it "adds simple values as context" do
|
||||
expect_any_instance_of(Bugsnag::Report).to receive(:add_metadata).with(
|
||||
:metadata, { data: "ABC123" }
|
||||
)
|
||||
|
||||
Alert.raise("hey", "ABC123")
|
||||
end
|
||||
|
||||
it "is compatible with Bugsnag API" do
|
||||
expect_any_instance_of(Bugsnag::Report).to receive(:add_metadata).with(
|
||||
:order, { number: "ABC123" }
|
||||
)
|
||||
@@ -56,8 +68,6 @@ RSpec.describe Alert do
|
||||
end
|
||||
|
||||
it "sends ActiveRecord objects" do
|
||||
pending "Bugsnag calls in CI" if ENV.fetch("CI", false)
|
||||
|
||||
order = Spree::Order.new(number: "ABC123")
|
||||
|
||||
expect_any_instance_of(Bugsnag::Report).to receive(:add_metadata).with(
|
||||
@@ -68,8 +78,6 @@ RSpec.describe Alert do
|
||||
end
|
||||
|
||||
it "notifies Bugsnag when ActiveRecord object is missing" do
|
||||
pending "Bugsnag calls in CI" if ENV.fetch("CI", false)
|
||||
|
||||
expect_any_instance_of(Bugsnag::Report).to receive(:add_metadata).with(
|
||||
"NilClass", { record_was_nil: true }
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user