-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
61e0615
commit 4a82463
Showing
6 changed files
with
107 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<% content_for :title, I18n.t(".system_error_title") %> | ||
|
||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
<h1 class="govuk-heading-m"><%= I18n.t(".system_error_heading") %></h1> | ||
<p class="govuk-body"><%= I18n.t(".system_error_text") %></p> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
spec/services/concerns/waste_carriers_engine/can_add_debug_logging_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rails_helper" | ||
|
||
class DebugClass | ||
include WasteCarriersEngine::CanAddDebugLogging | ||
end | ||
|
||
module WasteCarriersEngine | ||
RSpec.describe CanAddDebugLogging do | ||
|
||
describe "#log_transient_registration_details" do | ||
|
||
let(:transient_registration) { create(:new_registration, :has_required_data) } | ||
|
||
subject(:log_details) { DebugClass.new.log_transient_registration_details("foo", transient_registration) } | ||
|
||
before do | ||
allow(Airbrake).to receive(:notify) | ||
allow(FeatureToggle).to receive(:active?).with(:additional_debug_logging).and_return true | ||
end | ||
|
||
it "logs an error" do | ||
log_details | ||
expect(Airbrake).to have_received(:notify) | ||
end | ||
|
||
context "with a nil transient_registration" do | ||
before { allow(transient_registration).to receive(:nil?).and_return(true) } | ||
|
||
it "logs an error" do | ||
log_details | ||
expect(Airbrake).to have_received(:notify) | ||
end | ||
end | ||
|
||
context "when the additional logging raises an exception" do | ||
before { allow(transient_registration).to receive(:metaData).and_raise(StandardError) } | ||
|
||
it "catches the exception and notifies Airbrake anyway" do | ||
log_details | ||
expect(Airbrake).to have_received(:notify) | ||
end | ||
end | ||
|
||
context "when the call to Airbrake fails" do | ||
before { allow(Airbrake).to receive(:notify).and_raise(StandardError) } | ||
|
||
it "completes without raising another exception" do | ||
expect { log_details }.not_to raise_error | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters