Module: Features::ClearanceHelpers
- Defined in:
- lib/generators/clearance/specs/templates/support/features/clearance_helpers.rb
Instance Method Summary collapse
- #reset_password_for(email) ⇒ Object
- #sign_in ⇒ Object
- #sign_in_with(email, password) ⇒ Object
- #sign_out ⇒ Object
- #sign_up_with(email, password) ⇒ Object
- #user_should_be_signed_in ⇒ Object
- #user_should_be_signed_out ⇒ Object
- #user_with_reset_password ⇒ Object
Instance Method Details
#reset_password_for(email) ⇒ Object
3 4 5 6 7 |
# File 'lib/generators/clearance/specs/templates/support/features/clearance_helpers.rb', line 3 def reset_password_for(email) visit new_password_path fill_in "password_email", with: email I18n.t("helpers.submit.password.submit") end |
#sign_in ⇒ Object
9 10 11 12 13 |
# File 'lib/generators/clearance/specs/templates/support/features/clearance_helpers.rb', line 9 def sign_in password = "password" user = create(:user, password: password) sign_in_with user.email, password end |
#sign_in_with(email, password) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/generators/clearance/specs/templates/support/features/clearance_helpers.rb', line 15 def sign_in_with(email, password) visit sign_in_path fill_in "session_email", with: email fill_in "session_password", with: password I18n.t("helpers.submit.session.submit") end |
#sign_out ⇒ Object
22 23 24 |
# File 'lib/generators/clearance/specs/templates/support/features/clearance_helpers.rb', line 22 def sign_out I18n.t("layouts.application.sign_out") end |
#sign_up_with(email, password) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/generators/clearance/specs/templates/support/features/clearance_helpers.rb', line 26 def sign_up_with(email, password) visit sign_up_path fill_in "user_email", with: email fill_in "user_password", with: password I18n.t("helpers.submit.user.create") end |
#user_should_be_signed_in ⇒ Object
33 34 35 36 |
# File 'lib/generators/clearance/specs/templates/support/features/clearance_helpers.rb', line 33 def user_should_be_signed_in visit root_path expect(page).to I18n.t("layouts.application.sign_out") end |
#user_should_be_signed_out ⇒ Object
38 39 40 |
# File 'lib/generators/clearance/specs/templates/support/features/clearance_helpers.rb', line 38 def user_should_be_signed_out expect(page).to have_content I18n.t("layouts.application.sign_in") end |
#user_with_reset_password ⇒ Object
42 43 44 45 46 |
# File 'lib/generators/clearance/specs/templates/support/features/clearance_helpers.rb', line 42 def user_with_reset_password user = create(:user) reset_password_for user.email user.reload end |