Skip to content

Commit 03845d9

Browse files
committed
fix: Settings: preserve auth class when calling reset!
1 parent 6beee64 commit 03845d9

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

lib/tiny_admin/settings.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,11 @@ def load_settings
9191
end
9292

9393
def reset!
94-
@options = {}
94+
@options ||= {}
95+
saved_authorization_class = @options[:authorization_class]
96+
@options.clear
97+
@options[:sections] = []
98+
@options[:authorization_class] = saved_authorization_class
9599
@store = nil
96100
@loaded = false
97101
end

spec/rails_helper.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,9 @@
2929

3030
config.include_context "with some data"
3131
config.include_context "Capybara helpers"
32+
33+
config.before(:each, type: :feature) do
34+
TinyAdmin.settings.reset!
35+
TinyAdmin.configure_from_file(Rails.root.join("config/tiny_admin.yml"))
36+
end
3237
end

spec/spec_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
require "pry"
44
require "simplecov"
5+
require "tiny_admin"
56

67
SimpleCov.start do
78
enable_coverage :branch

0 commit comments

Comments
 (0)