summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis Reigel <alexis.reigel.ext@siemens.com>2018-09-26 17:25:31 +0200
committerAlexis Reigel <alexis.reigel.ext@siemens.com>2018-10-01 13:24:16 +0200
commitf38aa2bf3043fbfa49cafad3834f3d4aada75afd (patch)
tree1a70d3177b4313e34654c92f7f3c4e468239c9ed
parent921c96ab0c9fe0fb532a3261f2664268b48e3bce (diff)
downloadgitlab-ce-f38aa2bf3043fbfa49cafad3834f3d4aada75afd.tar.gz
add missing allowed attributes
-rw-r--r--app/services/users/build_service.rb4
-rw-r--r--spec/services/users/build_service_spec.rb42
2 files changed, 45 insertions, 1 deletions
diff --git a/app/services/users/build_service.rb b/app/services/users/build_service.rb
index f31972bfd54..f12e80b4d8e 100644
--- a/app/services/users/build_service.rb
+++ b/app/services/users/build_service.rb
@@ -68,7 +68,9 @@ module Users
:twitter,
:username,
:website_url,
- :private_profile
+ :private_profile,
+ :organization,
+ :location
]
end
diff --git a/spec/services/users/build_service_spec.rb b/spec/services/users/build_service_spec.rb
index b987fe45138..7b2444489cb 100644
--- a/spec/services/users/build_service_spec.rb
+++ b/spec/services/users/build_service_spec.rb
@@ -14,6 +14,48 @@ describe Users::BuildService do
expect(service.execute).to be_valid
end
+ context 'allowed params' do
+ let(:params) do
+ {
+ access_level: 1,
+ admin: 1,
+ avatar: anything,
+ bio: 1,
+ can_create_group: 1,
+ color_scheme_id: 1,
+ email: 1,
+ external: 1,
+ force_random_password: 1,
+ hide_no_password: 1,
+ hide_no_ssh_key: 1,
+ linkedin: 1,
+ name: 1,
+ password: 1,
+ password_automatically_set: 1,
+ password_expires_at: 1,
+ projects_limit: 1,
+ remember_me: 1,
+ skip_confirmation: 1,
+ skype: 1,
+ theme_id: 1,
+ twitter: 1,
+ username: 1,
+ website_url: 1,
+ private_profile: 1,
+ organization: 1,
+ location: 1
+ }
+ end
+
+ it 'sets all allowed attributes' do
+ admin_user # call first so the admin gets created before setting `expect`
+
+ expect(User).to receive(:new).with(hash_including(params)).and_call_original
+
+ service.execute
+ end
+ end
+
context 'with "user_default_external" application setting' do
using RSpec::Parameterized::TableSyntax