Sha256: 507602c33726eeb288fd0ce2e39af689c4e138f0fc13f975237db113b51ba080

Contents?: true

Size: 972 Bytes

Versions: 2

Compression:

Stored size: 972 Bytes

Contents

require 'spec_helper'
require 'support/features/feature_helpers'

feature 'visitor updates password' do
  before(:each) do
    @user = create(:user, :with_password_reset_token_and_timestamp)
  end

  scenario 'with a valid password' do
    update_password @user, 'newpassword'

    expect_user_to_be_signed_in
  end

  scenario 'with a blank password' do
    update_password @user, ''

    expect(page).to have_content I18n.t('flashes.failure_after_update')
    expect_user_to_be_signed_out
  end

  scenario 'signs in with new password' do
    update_password @user, 'newpassword'

    sign_out
    sign_in_with @user.email, 'newpassword'
    expect_user_to_be_signed_in
  end
end


def update_password(user, password)
  visit_password_reset_page_for user
  fill_in 'password_reset_password', with: password
  click_button 'Save this password'
end

def visit_password_reset_page_for(user)
  visit edit_users_password_path(id: user, token: user.password_reset_token)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
authenticate-0.3.1 spec/features/password_update_spec.rb
authenticate-0.3.0 spec/features/password_update_spec.rb