diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-12-08 15:22:04 +0100 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-12-08 15:22:04 +0100 |
commit | 15925290eec4f5616e12ef3169794f85150e3270 (patch) | |
tree | b1adb5784f74a05491a38b8656e179f451b79e5e /spec/models/user_spec.rb | |
parent | 0c3f70acf4838194f517c02874b8423303c21b48 (diff) | |
parent | 51ed5225adf4aac3ccbf715f8647258dac784abb (diff) | |
download | gitlab-ce-ui/dashboard-new-issue.tar.gz |
Merge branch 'master' into ui/dashboard-new-issueui/dashboard-new-issue
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) } |