Sha256: 7932f40e448038bf0f7caaf674046b6cdad7c638484390c404001fb02c4f888f

Contents?: true

Size: 1.12 KB

Versions: 7

Compression:

Stored size: 1.12 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(I18n.t('nav.nyauth.common.send'))

      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(I18n.t('nav.nyauth.common.set'))

      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(I18n.t('nav.nyauth.common.send'))

      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.7.2 spec/featrues/nyauth/reset_password_requests_spec.rb
nyauth-0.7.1 spec/featrues/nyauth/reset_password_requests_spec.rb
nyauth-0.7.0 spec/featrues/nyauth/reset_password_requests_spec.rb
nyauth-0.6.2 spec/featrues/nyauth/reset_password_requests_spec.rb
nyauth-0.6.1 spec/featrues/nyauth/reset_password_requests_spec.rb
nyauth-0.6.0 spec/featrues/nyauth/reset_password_requests_spec.rb
nyauth-0.5.0 spec/featrues/nyauth/reset_password_requests_spec.rb