Sha256: ec2b18f6a1edf49a6d11fbc103d789e3339c6b18d3ca4c725d035ed82768ed17

Contents?: true

Size: 1.17 KB

Versions: 15

Compression:

Stored size: 1.17 KB

Contents

module Features
  module SessionHelpers

    def sign_up_with(name, email, password, password_confirmation = nil)
      visit locomotive.sign_up_path
      fill_in 'Name', with: name
      fill_in 'Email', with: email
      fill_in 'locomotive_account[password]', with: password
      fill_in 'locomotive_account[password_confirmation]', with: password_confirmation || password
      click_button 'Register'
    end

    def sign_in
      @account = create(:account)
      visit locomotive.new_locomotive_account_session_path
      fill_in 'Email', with: @account.email
      fill_in 'Password', with: @account.password
      click_button 'Sign in'
    end

    def forgot_password(&block)
      sign_up_with 'John Doe', 'john@doe.net', 'password'
      click_link 'John Doe'
      within('.navigation') { click_link 'Log out' }
      # click_link 'Log out'
      click_link 'Forgot my password'
      fill_in 'Your email', with: 'john@doe.net'
      click_button 'Submit'

      if block_given?
        sleep(1)
        last_email = ActionMailer::Base.deliveries.last
        last_email.body.to_s =~ /<a href="http:\/\/localhost:9886(\S+)">/
        yield last_email, $1
      end
    end

  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
locomotivecms-3.3.0 spec/support/features/session_helpers.rb
locomotivecms-3.3.0.rc3 spec/support/features/session_helpers.rb
locomotivecms-3.3.0.rc2 spec/support/features/session_helpers.rb
locomotivecms-3.1.2 spec/support/features/session_helpers.rb
locomotivecms-3.2.1 spec/support/features/session_helpers.rb
locomotivecms-3.3.0.rc1 spec/support/features/session_helpers.rb
locomotivecms-3.2.0 spec/support/features/session_helpers.rb
locomotivecms-3.2.0.rc2 spec/support/features/session_helpers.rb
locomotivecms-3.2.0.rc1 spec/support/features/session_helpers.rb
locomotivecms-3.1.1 spec/support/features/session_helpers.rb
locomotivecms-3.1.0 spec/support/features/session_helpers.rb
locomotivecms-3.1.0.rc3 spec/support/features/session_helpers.rb
locomotivecms-3.1.0.rc2 spec/support/features/session_helpers.rb
locomotivecms-3.1.0.rc1 spec/support/features/session_helpers.rb
locomotivecms-3.0.1 spec/support/features/session_helpers.rb