Sha256: fd1edaec809875ccc67da6223540cce2ba9d4b4be6788611da99ea0fae480f72

Contents?: true

Size: 1.03 KB

Versions: 7

Compression:

Stored size: 1.03 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')

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
nyauth-0.3.0 spec/featrues/nyauth/reset_password_requests_spec.rb
nyauth-0.2.8 spec/featrues/nyauth/reset_password_requests_spec.rb
nyauth-0.2.7 spec/featrues/nyauth/reset_password_requests_spec.rb
nyauth-0.2.6 spec/featrues/nyauth/reset_password_requests_spec.rb
nyauth-0.2.5 spec/featrues/nyauth/reset_password_requests_spec.rb
nyauth-0.2.4 spec/featrues/nyauth/reset_password_requests_spec.rb
nyauth-0.2.3 spec/featrues/nyauth/reset_password_requests_spec.rb