Module: Features::ClearanceHelpers

Defined in:
lib/generators/clearance/specs/templates/support/features/clearance_helpers.rb

Instance Method Summary collapse

Instance Method Details

#reset_password_for(email) ⇒ Object



43
44
45
46
47
# File 'lib/generators/clearance/specs/templates/support/features/clearance_helpers.rb', line 43

def reset_password_for(email)
  visit new_password_path
  fill_in 'password_email', :with => email
  click_button I18n.t('helpers.submit.password.submit')
end

#sign_in_with(email, password) ⇒ Object



10
11
12
13
14
15
# File 'lib/generators/clearance/specs/templates/support/features/clearance_helpers.rb', line 10

def (email, password)
  visit 
  fill_in 'session_email', :with => email
  fill_in 'session_password', :with => password
  click_button I18n.t('helpers.submit.session.submit')
end

#sign_outObject



29
30
31
# File 'lib/generators/clearance/specs/templates/support/features/clearance_helpers.rb', line 29

def sign_out
  click_link I18n.t('layouts.application.sign_out')
end

#sign_up_with(email, password) ⇒ Object



3
4
5
6
7
8
# File 'lib/generators/clearance/specs/templates/support/features/clearance_helpers.rb', line 3

def (email, password)
  visit 
  fill_in 'user_email', :with => email
  fill_in 'user_password', :with => password
  click_button I18n.t('helpers.submit.user.create')
end

#signed_in_userObject



17
18
19
20
21
22
# File 'lib/generators/clearance/specs/templates/support/features/clearance_helpers.rb', line 17

def signed_in_user
  password = 'password'
  user = create(:user, :password => password)
   user.email, password
  user
end

#user_should_be_signed_inObject



24
25
26
27
# File 'lib/generators/clearance/specs/templates/support/features/clearance_helpers.rb', line 24

def user_should_be_signed_in
  visit root_path
  page.should have_content I18n.t('layouts.application.sign_out')
end

#user_should_be_signed_outObject



33
34
35
# File 'lib/generators/clearance/specs/templates/support/features/clearance_helpers.rb', line 33

def user_should_be_signed_out
  page.should have_content I18n.t('layouts.application.sign_in')
end

#user_with_reset_passwordObject



37
38
39
40
41
# File 'lib/generators/clearance/specs/templates/support/features/clearance_helpers.rb', line 37

def user_with_reset_password
  user = create(:user)
  reset_password_for user.email
  user.reload
end