Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module DeviseRequestSpecHelpers
- def create_and_login_user(email=nil, password=nil)
- email = email || Faker::Internet.email
- password = password || Faker::Internet.password(8)
- visit new_user_registration_path
- fill_in 'user_email', with: email
- fill_in 'user_password', with: password
- fill_in 'user_password_confirmation', with: password
- click_button 'cadastrar'
- end
- def login_user(email, password)
- visit new_user_session_path
- fill_in 'user_email', with: email
- fill_in 'user_password', with: password
- click_button 'entrar'
- end
- def login_and_return_user(hash={})
- password = hash['password'] || Faker::Internet.password(8)
- hash.merge!({password: password, password_confirmation: password})
- user = FactoryGirl.create(:user, hash)
- login_user(user.email, password)
- user
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement