Guest User

Untitled

a guest
Mar 13th, 2018
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. # user_spec.rb
  2.  
  3. describe 'invalid passwords' do
  4. before( :each ) do
  5. @user = User.create(:password => 'abcd', :password_confirmation => 'abcd', :email => 'test@email.com')
  6. end
  7.  
  8. it 'are the same as the original password' do
  9. @user.password_confirmation = @user.password = 'originalpassword'
  10. # @user.send(:validate)
  11. # p @user.errors
  12. @user.save
  13. # puts @user.errors.inspect.gsub( /</, "<" )
  14. @user.save == true
  15. puts @user.errors.inspect.gsub( /</, "<" )
  16.  
  17. @user.password_confirmation = @user.password = 'originalpassword'
  18. @user.save
  19. # @user.send(:validate)
  20. p @user.errors
  21. # @user.should have(1).error_on(:password)
  22. @user.save.should == false
  23. end
  24.  
  25. end
Add Comment
Please, Sign In to add comment