Sha256: d5c263fd0bcd5ebd72eaf46b7344beb877e9b6fb85bb5c55bc18534ca5eebbe4

Contents?: true

Size: 1.18 KB

Versions: 4

Compression:

Stored size: 1.18 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('user_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('user_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')

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nyauth-0.2.2 spec/featrues/nyauth/reset_password_requests_spec.rb
nyauth-0.2.1 spec/featrues/nyauth/reset_password_requests_spec.rb
nyauth-0.2.0 spec/featrues/nyauth/reset_password_requests_spec.rb
nyauth-0.1.0 spec/featrues/nyauth/reset_password_requests_spec.rb