Skip to content

Commit

Permalink
Adds missing test for 'outside data sync' context
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisBAshton committed Oct 21, 2020
1 parent f15ba2f commit 2f143f0
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions spec/govuk_error/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
end

describe ".should_capture" do
let(:configuration) { GovukError::Configuration.new(Raven.configuration) }

context "during the data sync" do
around do |example|
ClimateControl.modify GOVUK_DATA_SYNC_PERIOD: "22:00-08:00" do
Expand All @@ -21,8 +23,6 @@
end
end

let(:configuration) { GovukError::Configuration.new(Raven.configuration) }

it "should capture errors by default" do
expect(configuration.should_capture.call(StandardError.new)).to eq(true)
end
Expand Down Expand Up @@ -61,6 +61,22 @@
expect(configuration.should_capture.call(SomeInheritedClass.new)).to eq(false)
end
end

context "outside of the data sync" do
around do |example|
ClimateControl.modify GOVUK_DATA_SYNC_PERIOD: "22:00-08:00" do
travel_to(Time.current.change(hour: 21)) do
example.run
end
end
end

it "should capture errors even if they are in the list of data_sync_excluded_exceptions" do
configuration.data_sync_excluded_exceptions << "StandardError"

expect(configuration.should_capture.call(StandardError.new)).to eq(true)
end
end
end

describe ".should_capture=" do
Expand Down

0 comments on commit 2f143f0

Please sign in to comment.