Guest User

Untitled

a guest
Mar 9th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. class UserTest < ActiveSupport::TestCase
  2. should_belong_to :customer
  3.  
  4. context "Clearance tests" do
  5. setup do
  6. User.any_instance.stubs(:generate_random_password)
  7. end
  8. include Clearance::Test::Unit::UserTest
  9. end
  10.  
  11. context "A user instance" do
  12. setup { @user = Factory(:email_confirmed_user) }
  13.  
  14. should "correctly generate a random password" do
  15. ActiveSupport::SecureRandom.expects(:hex).with(6).returns("random password")
  16. @user.expects(:password=).with("random password")
  17. @user.expects(:password_confirmation=).with("random password")
  18. @user.generate_random_password
  19. end
  20.  
  21. # etc.
  22. end
  23. end
Add Comment
Please, Sign In to add comment