Merge pull request #971 from gingko/master
Automatic password creation..
This commit is contained in:
commit
4c1f435ab7
4 changed files with 56 additions and 7 deletions
|
@ -22,6 +22,24 @@ describe User do
|
|||
user.identifier.should == "test_mail_com"
|
||||
end
|
||||
|
||||
it "should execute callback when force_random_password specified" do
|
||||
user = User.new(:email => "test@mail.com", :force_random_password => true)
|
||||
user.should_receive(:generate_password)
|
||||
user.save
|
||||
end
|
||||
|
||||
it "should not generate password by default" do
|
||||
user = Factory(:user, :password => 'abcdefg', :password_confirmation => 'abcdefg')
|
||||
user.password.should == 'abcdefg'
|
||||
end
|
||||
|
||||
it "should generate password when forcing random password" do
|
||||
Devise.stub(:friendly_token).and_return('123456789')
|
||||
user = User.create(:email => "test1@mail.com", :force_random_password => true)
|
||||
user.password.should == user.password_confirmation
|
||||
user.password.should == '12345678'
|
||||
end
|
||||
|
||||
it "should have authentication token" do
|
||||
user = Factory(:user)
|
||||
user.authentication_token.should_not == ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue