Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class UserTest < ActiveSupport::TestCase
- should_belong_to :customer
- context "Clearance tests" do
- setup do
- User.any_instance.stubs(:generate_random_password)
- end
- include Clearance::Test::Unit::UserTest
- end
- context "A user instance" do
- setup { @user = Factory(:email_confirmed_user) }
- should "correctly generate a random password" do
- ActiveSupport::SecureRandom.expects(:hex).with(6).returns("random password")
- @user.expects(:password=).with("random password")
- @user.expects(:password_confirmation=).with("random password")
- @user.generate_random_password
- end
- # etc.
- end
- end
Add Comment
Please, Sign In to add comment