-
-
Save raine/1057422 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe User do | |
it "should create a new user given a username" do | |
User.create!(:username => "rmcenroe") | |
end | |
it "should not create a new user given a bad username" do | |
bad_user = User.new(:username => "not_real") | |
bad_user.should_not be_valid | |
end | |
it "should return false for bad username" do | |
User.valid_username?("bad_username").should be_false | |
end | |
it "should return true for good username" do | |
User.valid_username?("gomezn").should be_true | |
end | |
it "should not allow for multiple users with the same username" do | |
user = Factory(:user) | |
user.should be_valid | |
second_user = Factory(:user, :username => user.username) | |
second_user.should_not be_valid | |
second_user.errors[:username].should_not be_blank # not sure about this, some people seem to like it | |
end | |
it "should have ldap params" do | |
user = Factory(:user, :username =>"gomezn") | |
user.email.should == "[email protected]" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment