Sha256: 8ccdb98d08f4e5fe7cfdfd03658d47c2e810ad518014941aa3a40932fd14cb21

Contents?: true

Size: 982 Bytes

Versions: 12

Compression:

Stored size: 982 Bytes

Contents

require 'spec_helper'

describe "Password reset feature." do
  let(:user) { create(:alchemy_admin_user) }

  it "User can visit password reset form." do
    visit new_password_path

    expect(page).to have_content('Password reset')
  end

  it "User can request password reset." do
    visit new_password_path

    fill_in :user_email, with: user.email
    click_button 'Send reset instructions'

    expect(page)
      .to have_content('You will receive an email with instructions on how to reset your password in a few minutes.')
  end

  it "User can change password." do
    allow(Alchemy::User)
      .to receive(:reset_password_by_token)
      .and_return(user)

    visit edit_password_path(id: user.id, reset_password_token: '1234')

    fill_in :user_password, with: 'secret123'
    fill_in :user_password_confirmation, with: 'secret123'
    click_button 'Change password'

    expect(page)
      .to have_content('Your password has been changed successfully.')
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
alchemy-devise-4.2.0 spec/features/password_reset_feature_spec.rb
alchemy-devise-4.1.0 spec/features/password_reset_feature_spec.rb
alchemy-devise-4.1.0.beta spec/features/password_reset_feature_spec.rb
alchemy-devise-4.0.0 spec/features/password_reset_feature_spec.rb
alchemy-devise-3.6.0 spec/features/password_reset_feature_spec.rb
alchemy-devise-3.5.0 spec/features/password_reset_feature_spec.rb
alchemy-devise-3.5.0.beta spec/features/password_reset_feature_spec.rb
alchemy-devise-3.4.0 spec/features/password_reset_feature_spec.rb
alchemy-devise-3.3.0 spec/features/password_reset_feature_spec.rb
alchemy-devise-3.2.0 spec/features/password_reset_feature_spec.rb
alchemy-devise-2.1.0 spec/features/password_reset_feature_spec.rb
alchemy-devise-2.1.0.beta3 spec/features/password_reset_feature_spec.rb