diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-12-08 13:40:32 +0100 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-12-08 13:40:32 +0100 |
commit | 926c3bef9fbda49d5cab268bcd83355142e945c1 (patch) | |
tree | 1dc2b7eb13485f0fc656cc913ca56e57b672b62a /spec/models/user_spec.rb | |
parent | 1a10945066d0da1801bb4cf89ce5f54996f1756f (diff) | |
parent | f5430e48b42227f1c1874ca27c6907f0f704be28 (diff) | |
download | gitlab-ce-reference-pipeline-and-caching.tar.gz |
Merge branch 'master' into reference-pipeline-and-cachingreference-pipeline-and-caching
Diffstat (limited to 'spec/models/user_spec.rb')
-rw-r--r-- | spec/models/user_spec.rb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 4631b12faf1..a0f78d3b336 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -91,7 +91,23 @@ describe User do end describe 'validations' do - it { is_expected.to validate_presence_of(:username) } + describe 'username' do + it 'validates presence' do + expect(subject).to validate_presence_of(:username) + end + + it 'rejects blacklisted names' do + user = build(:user, username: 'dashboard') + + expect(user).not_to be_valid + expect(user.errors.values).to eq [['dashboard is a reserved name']] + end + + it 'validates uniqueness' do + expect(subject).to validate_uniqueness_of(:username) + end + end + it { is_expected.to validate_presence_of(:projects_limit) } it { is_expected.to validate_numericality_of(:projects_limit) } it { is_expected.to allow_value(0).for(:projects_limit) } |