diff options
author | Rémy Coutable <remy@rymai.me> | 2016-07-08 08:29:18 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-07-08 08:29:18 +0000 |
commit | 2c650b6f30d2e76cf632d6ce5771859aed67ac48 (patch) | |
tree | 58112a7439cc49392052ab43ab29821435a509fe /spec | |
parent | 5d0b06a038a205f52f73f4cfd2947799f12698d0 (diff) | |
parent | a0a9494e4e6db3cfcdecae0a7e9c2877432fa30b (diff) | |
download | gitlab-ce-2c650b6f30d2e76cf632d6ce5771859aed67ac48.tar.gz |
Merge branch 'feature/option-set-new-users-external' into 'master'
Added setting to set new users by default as external
## What does this MR do?
This implements the feature request #14508. It adds an option in the application settings to set new users by default as external.
## Are there points in the code the reviewer needs to double check?
Everything. Like I mentioned in the discussion of the issue my knowledge of Ruby basically doesn't exists. I tested it on my machine and it seems to work, but as I am very unexperienced in Ruby I highly recommend to take a close look at the code.
## Why was this MR needed?
It was requested by @DouweM to work on the issue with the proposed changes by me.
## What are the relevant issue numbers?
This MR is for the issue #14508 that followed up after the implementation of #4009.
See merge request !4545
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 |