Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

No need to restore settings after test

Christophe Bliard63a05f6307ba
diff --git a/spec/controllers/admin/settings/authentication_controller_spec.rb b/spec/controllers/admin/settings/authentication_controller_spec.rb
index b2fbce0a573..b7c5dbb56f8 100644
--- a/spec/controllers/admin/settings/authentication_controller_spec.rb
+++ b/spec/controllers/admin/settings/authentication_controller_spec.rb
@@ -40,7 +40,8 @@ RSpec.describe Admin::Settings::AuthenticationSettingsController do
describe 'PATCH #update' do
render_views
- current_user { create(:admin) }
+ shared_let(:admin) { create(:admin) }
+ current_user { admin }
describe 'registration_footer' do
let(:old_settings) do
@@ -61,18 +62,10 @@ RSpec.describe Admin::Settings::AuthenticationSettingsController do
}
end
- around do |example|
- original_settings = {}
+ before do
old_settings.each_key do |key|
- original_settings[key] = Setting[key]
Setting[key] = old_settings[key]
end
- example.run
- ensure
- # restore settings
- old_settings.each_key do |key|
- Setting[key] = original_settings[key]
- end
end
describe 'when writable' do