summaryrefslogtreecommitdiff
path: root/spec/features/admin
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2017-03-18 02:29:25 -0700
committerStan Hu <stanhu@gmail.com>2017-03-18 15:39:48 -0700
commit681af5bc4fe646a981c1d0bbbeddef00f5cee3b8 (patch)
tree9a65ccf9ccd4e2cd4836638b42613e6bc0ae77f0 /spec/features/admin
parent5d71d9fb9d6ca89710549fbfef62d105d9544a30 (diff)
downloadgitlab-ce-681af5bc4fe646a981c1d0bbbeddef00f5cee3b8.tar.gz
Fix Error 500 when application settings are saved
Due to a Rails bug, fetching the application settings from Redis may prevent the attribute methods from being loaded for the `ApplicationSetting` model. More details here: https://github.com/rails/rails/issues/27348 There was also a secondary problem introduced by overriding these association methods which caused all default visibility levels to be set to `nil`. Before, the previous implementation allowed the string "20" to be saved as an integer, while now a table lookup happens before that. We fix this by enforcing the integer value in the controller and default to PRIVATE. Closes #29674
Diffstat (limited to 'spec/features/admin')
-rw-r--r--spec/features/admin/admin_settings_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb
index de42ab81fac..b54ba9f5f88 100644
--- a/spec/features/admin/admin_settings_spec.rb
+++ b/spec/features/admin/admin_settings_spec.rb
@@ -9,6 +9,14 @@ feature 'Admin updates settings', feature: true do
visit admin_application_settings_path
end
+ scenario 'Change visibility settings' do
+ first(:radio_button, 'Public').set(true)
+ click_button 'Save'
+
+ expect(page).to have_content "Application settings saved successfully"
+ expect(ApplicationSetting.current.default_project_visibility).to eq(Gitlab::VisibilityLevel::PUBLIC)
+ end
+
scenario 'Change application settings' do
uncheck 'Gravatar enabled'
fill_in 'Home page URL', with: 'https://about.gitlab.com/'