Sha256: b6db4e7154570cae5016d08f5e178142f65c22805978a055c31ea9a7c02947ed

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

require 'rails_helper'

RSpec.describe 'Nyauth::NewPasswordRequests' do
  let!(:user) { create(:user) }

  feature 'confirmation' do
    let(:reset_password) { 'cool_password' }
    background do
      visit nyauth.new_reset_password_request_path
    end

    scenario 'request & set reset password' do
      fill_in('reset_password_request_email', with: user.email)
      click_button('reset password')

      open_email(user.email)
      current_email.click_link('set new password')

      fill_in('user_password', with: reset_password)
      fill_in('user_password_confirmation', with: reset_password)
      click_button('Update')

      expect(page).to have_content('updated')
      expect(current_path).to eq nyauth.new_session_path
    end

    scenario 'request expired' do
      fill_in('reset_password_request_email', with: user.email)
      click_button('reset password')

      Timecop.freeze(Time.current + 3.hours) do
        open_email(user.email)
        current_email.click_link('set new password')

        expect(page).to have_content('expired')
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nyauth-0.4.0 spec/featrues/nyauth/reset_password_requests_spec.rb