Sha256: e66e3075da836f41a75e1e73998748a30cfec9494a1430d3629d29d841251899

Contents?: true

Size: 1.63 KB

Versions: 21

Compression:

Stored size: 1.63 KB

Contents

require 'spec_helper'

feature 'user resets password' do
  before(:each) do
    @user = FactoryGirl.create(:user, password: 'password1234')
    visit lines.login_path
    expect(page).to have_content "Forgot password"
    click_on "Forgot password"
    expect(page).to have_content "Reset password"
    fill_in "password_reset_email", with: @user.email
    find('input[name="commit"]').click
    expect(page).to have_content "Reset instructions have been sent"
    #generate new reset token
    @user.create_reset_digest
    visit lines.edit_password_reset_url(@user.reload.reset_token, email: @user.email)
    expect(page).to have_content 'Set new password'
  end

  scenario 'with valid password' do
    fill_in "user_password", with: 'testtest'
    fill_in "user_password_confirmation", with: 'testtest'
    find('input[name="commit"]').click
    expect(page).to have_content 'Password has been reset.'
    expect(@user.reload.reset_digest).to eq nil
  end

  scenario 'with password too short' do
    fill_in "user_password", with: 't'
    fill_in "user_password_confirmation", with: 't'
    find('input[name="commit"]').click
    expect(page).to have_content 'too short'
  end

  scenario 'with empty password' do
    fill_in "user_password", with: ''
    fill_in "user_password_confirmation", with: ''
    find('input[name="commit"]').click
    expect(page).to have_content "Password can't be blank"
  end

  scenario 'with password confirmation not matching' do
    fill_in "user_password", with: 'testtest'
    fill_in "user_password_confirmation", with: 'testtest234'
    find('input[name="commit"]').click
    expect(page).to have_content 'not match'
  end

end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
jeygeethanmedia-inkpen-1.2.6.2 spec/features/password_reset_spec.rb
jeygeethanmedia-inkpen-1.2.6.1 spec/features/password_reset_spec.rb
lines-engine-1.2.6.1 spec/features/password_reset_spec.rb
lines-engine-1.2.6 spec/features/password_reset_spec.rb
lines-engine-1.2.5 spec/features/password_reset_spec.rb
lines-engine-1.2.3 spec/features/password_reset_spec.rb
lines-engine-1.2.2 spec/features/password_reset_spec.rb
lines-engine-1.2.1.1 spec/features/password_reset_spec.rb
lines-engine-1.2.1 spec/features/password_reset_spec.rb
lines-engine-1.2 spec/features/password_reset_spec.rb
lines-engine-1.1.5.3 spec/features/password_reset_spec.rb
lines-engine-1.1.5.2 spec/features/password_reset_spec.rb
lines-engine-1.1.5.1 spec/features/password_reset_spec.rb
lines-engine-1.1.5 spec/features/password_reset_spec.rb
lines-engine-1.1.4 spec/features/password_reset_spec.rb
lines-engine-1.1.3 spec/features/password_reset_spec.rb
lines-engine-1.1.2 spec/features/password_reset_spec.rb
lines-engine-1.1.1 spec/features/password_reset_spec.rb
lines-engine-1.1.0 spec/features/password_reset_spec.rb
lines-engine-1.0.0 spec/features/password_reset_spec.rb