Sha256: e58b7678185faaf66fca26551451234a03614eccf2675d41a4e0e9523c466185

Contents?: true

Size: 1.26 KB

Versions: 5

Compression:

Stored size: 1.26 KB

Contents

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

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

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

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

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

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

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
clearance-1.2.0 lib/generators/clearance/specs/templates/support/features/clearance_helpers.rb
clearance-1.1.0 lib/generators/clearance/specs/templates/support/features/clearance_helpers.rb
clearance-1.0.1 lib/generators/clearance/specs/templates/support/features/clearance_helpers.rb
clearance-1.0.0 lib/generators/clearance/specs/templates/support/features/clearance_helpers.rb
clearance-1.0.0.rc8 lib/generators/clearance/specs/templates/support/features/clearance_helpers.rb