summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2017-03-21 07:21:01 +0000
committerRobert Speicher <robert@gitlab.com>2017-03-21 07:21:01 +0000
commitf592cae12992f86d711973a82296abfd7bf05bc4 (patch)
tree67d61337763428013489b0a260d78044cb379dcb /spec/controllers
parent977f6e379683d096aa5ae2db15330f35c3796dd2 (diff)
parent4e1cebabc7906f46cfab15602a5b9ae15448598d (diff)
downloadgitlab-ce-f592cae12992f86d711973a82296abfd7bf05bc4.tar.gz
Merge branch 'sh-fix-admin-application-settings' into 'master'
Fix Error 500 when application settings are saved Closes #29674 and #29115 See merge request !10070
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/admin/application_settings_controller_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/controllers/admin/application_settings_controller_spec.rb b/spec/controllers/admin/application_settings_controller_spec.rb
new file mode 100644
index 00000000000..84a1ce773a1
--- /dev/null
+++ b/spec/controllers/admin/application_settings_controller_spec.rb
@@ -0,0 +1,28 @@
+require 'spec_helper'
+
+describe Admin::ApplicationSettingsController do
+ include StubENV
+
+ let(:admin) { create(:admin) }
+
+ before do
+ sign_in(admin)
+ stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
+ end
+
+ describe 'PATCH #update' do
+ it 'updates the default_project_visibility for string value' do
+ patch :update, application_setting: { default_project_visibility: "20" }
+
+ expect(response).to redirect_to(admin_application_settings_path)
+ expect(ApplicationSetting.current.default_project_visibility).to eq Gitlab::VisibilityLevel::PUBLIC
+ end
+
+ it 'falls back to default with default_project_visibility setting is omitted' do
+ patch :update, application_setting: {}
+
+ expect(response).to redirect_to(admin_application_settings_path)
+ expect(ApplicationSetting.current.default_project_visibility).to eq Gitlab::VisibilityLevel::PRIVATE
+ end
+ end
+end