-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #3541 breaking on reload with parent_controller set
- Loading branch information
Showing
4 changed files
with
79 additions
and
12 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
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,37 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
RSpec.describe RailsAdmin::Config::ConstLoadSuppressor do | ||
describe '.suppressing' do | ||
it 'suppresses constant loading' do | ||
expect do | ||
subject.suppressing { UnknownConstant } | ||
end.not_to raise_error | ||
end | ||
|
||
it 'raises the error on recursion' do | ||
expect do | ||
subject.suppressing do | ||
subject.suppressing {} | ||
end | ||
end.to raise_error(/already suppressed/) | ||
end | ||
end | ||
|
||
describe '.allowing' do | ||
it 'suspends constant loading suppression' do | ||
expect do | ||
subject.suppressing do | ||
subject.allowing { UnknownConstant } | ||
end | ||
end.to raise_error NameError | ||
end | ||
|
||
it 'does not break when suppression is disabled' do | ||
expect do | ||
subject.allowing {} | ||
end.not_to raise_error | ||
end | ||
end | ||
end |