Skip to content
Extraits de code Groupes Projets
Valider 67bc58dd rédigé par Akihiko Odaki's avatar Akihiko Odaki Validation de Matt Jankowski
Parcourir les fichiers

Use around hook to restore context in Admin::SettingsController spec (#3428)

parent 2d39560d
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -47,20 +47,36 @@ RSpec.describe Admin::SettingsController, type: :controller do ...@@ -47,20 +47,36 @@ RSpec.describe Admin::SettingsController, type: :controller do
end end
end end
it 'updates a settings value' do context do
Setting.site_title = 'Original' around do |example|
patch :update, params: { site_title: 'New title' } site_title = Setting.site_title
example.run
Setting.site_title = site_title
end
expect(response).to redirect_to(edit_admin_settings_path) it 'updates a settings value' do
expect(Setting.site_title).to eq 'New title' Setting.site_title = 'Original'
patch :update, params: { site_title: 'New title' }
expect(response).to redirect_to(edit_admin_settings_path)
expect(Setting.site_title).to eq 'New title'
end
end end
it 'typecasts open_registrations to boolean' do context do
Setting.open_registrations = false around do |example|
patch :update, params: { open_registrations: 'true' } open_registrations = Setting.open_registrations
example.run
Setting.open_registrations = open_registrations
end
expect(response).to redirect_to(edit_admin_settings_path) it 'typecasts open_registrations to boolean' do
expect(Setting.open_registrations).to eq true Setting.open_registrations = false
patch :update, params: { open_registrations: 'true' }
expect(response).to redirect_to(edit_admin_settings_path)
expect(Setting.open_registrations).to eq true
end
end end
end end
end end
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter