Skip to content

Commit

Permalink
Fix constant redefinitions in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
snmaynard committed May 11, 2018
1 parent a73243d commit 11b7d9f
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions spec/bugsnag_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def require(path)
end

it 'attempts to load integrations' do
Kernel::REQUIRED = []
ENV["BUGSNAG_DISABLE_AUTOCONFIGURE"] = nil
load "./lib/bugsnag.rb"
Bugsnag::INTEGRATIONS.each do |integration|
Expand All @@ -42,36 +41,31 @@ def require(path)
end

it 'does not load integrations when BUGSNAG_DISABLE_AUTOCONFIGURE is true' do
Kernel::REQUIRED = []
ENV["BUGSNAG_DISABLE_AUTOCONFIGURE"] = 'true'
load "./lib/bugsnag.rb"
expect(Kernel::REQUIRED).to eq(["bugsnag/integrations/rack"])
end

it 'loads all integrations if requested' do
Kernel::REQUIRED = []
expect(Kernel::REQUIRED).to eq([])
Bugsnag.load_integrations
Bugsnag::INTEGRATIONS.each do |integration|
expect(Kernel::REQUIRED).to include("bugsnag/integrations/#{integration}")
end
end

it 'loads singular integrations' do
Kernel::REQUIRED = []
expect(Kernel::REQUIRED).to eq([])
Bugsnag::INTEGRATIONS.each do |integration|
Kernel::REQUIRED = []
Bugsnag::INTEGRATIONS.each do |integration|
it "loads #{integration}" do
Bugsnag.load_integration(integration)
expect(Kernel::REQUIRED).to include("bugsnag/integrations/#{integration}")
end
end

it 'loads railtie for :rails or :railtie' do
Kernel::REQUIRED = []
it 'loads railtie for rails' do
Bugsnag.load_integration(:rails)
expect(Kernel::REQUIRED).to include("bugsnag/integrations/railtie")
Kernel::REQUIRED = []
end

it 'loads railtie for railtie' do
Bugsnag.load_integration(:railtie)
expect(Kernel::REQUIRED).to include("bugsnag/integrations/railtie")
end
Expand Down

0 comments on commit 11b7d9f

Please sign in to comment.