Commit 9580d6e3 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Update invalid test application_settings_controller_spec.rb

There are 2 problems with this spec:

1. It checks for default visiblity level however there is not code in
controller to handle such default. Same check can be performed on model
directly.
2. It passes empty application_setting hash while controller requires
application_setting not to be empty by using `require` with `permit`
Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 8ab9bdc7
...@@ -72,11 +72,10 @@ describe Admin::ApplicationSettingsController do ...@@ -72,11 +72,10 @@ describe Admin::ApplicationSettingsController do
expect(ApplicationSetting.current.restricted_visibility_levels).to eq([10, 20]) expect(ApplicationSetting.current.restricted_visibility_levels).to eq([10, 20])
end end
it 'falls back to defaults when settings are omitted' do it 'updates the restricted_visibility_levels when empty array is passed' do
put :update, application_setting: {} put :update, application_setting: { restricted_visibility_levels: [] }
expect(response).to redirect_to(admin_application_settings_path) expect(response).to redirect_to(admin_application_settings_path)
expect(ApplicationSetting.current.default_project_visibility).to eq(Gitlab::VisibilityLevel::PRIVATE)
expect(ApplicationSetting.current.restricted_visibility_levels).to be_empty expect(ApplicationSetting.current.restricted_visibility_levels).to be_empty
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment