Commit b2ad4d5929440ad3376900312b2789fb851ad1b1
1 parent
ff21f967
Exists in
master
and in
1 other branch
validates uniqueness of github_login
Showing
2 changed files
with
11 additions
and
0 deletions
Show diff stats
app/models/user.rb
spec/models/user_spec.rb
| ... | ... | @@ -19,6 +19,16 @@ describe User do |
| 19 | 19 | user = Fabricate.build(:user, :password => nil, :github_login => 'nashby') |
| 20 | 20 | user.should be_valid |
| 21 | 21 | end |
| 22 | + | |
| 23 | + it 'requires uniq github login' do | |
| 24 | + user1 = Fabricate(:user, :github_login => 'nashby') | |
| 25 | + user1.should be_valid | |
| 26 | + | |
| 27 | + user2 = Fabricate.build(:user, :github_login => 'nashby') | |
| 28 | + user2.save | |
| 29 | + user2.should_not be_valid | |
| 30 | + user2.errors[:github_login].should include("is already taken") | |
| 31 | + end | |
| 22 | 32 | end |
| 23 | 33 | |
| 24 | 34 | describe '.find_for_github_oauth' do | ... | ... |