diff options
author | Dravere <floriangraf@gmx.ch> | 2016-07-06 19:46:41 +0200 |
---|---|---|
committer | Dravere <floriangraf@gmx.ch> | 2016-07-07 19:21:18 +0200 |
commit | a0a9494e4e6db3cfcdecae0a7e9c2877432fa30b (patch) | |
tree | d9a0ef27d88d3c5ae6492ddede5827f98633bd03 /spec | |
parent | 062c7a30742d617d8d0939c3bb6ba733919fe00b (diff) | |
download | gitlab-ce-a0a9494e4e6db3cfcdecae0a7e9c2877432fa30b.tar.gz |
Added setting to set new users by default as external
As requested by the issue #14508 this adds an option in the application
settings to set newly registered users by default as external. The
default setting is set to false to stay backward compatible.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/user_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 328254ed56b..3984b30ddf8 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -446,6 +446,7 @@ describe User, models: true do it { expect(user.can_create_group?).to be_truthy } it { expect(user.can_create_project?).to be_truthy } it { expect(user.first_name).to eq('John') } + it { expect(user.external).to be_falsey } end describe 'with defaults' do @@ -468,6 +469,26 @@ describe User, models: true do expect(user.theme_id).to eq(1) end end + + context 'when current_application_settings.user_default_external is true' do + before do + stub_application_setting(user_default_external: true) + end + + it "creates external user by default" do + user = build(:user) + + expect(user.external).to be_truthy + end + + describe 'with default overrides' do + it "creates a non-external user" do + user = build(:user, external: false) + + expect(user.external).to be_falsey + end + end + end end describe '.find_by_any_email' do |