Sha256: 8aa4ceb04de54eaea674a43443166405c34762d0e1d02bc5241f91970c85e857

Contents?: true

Size: 874 Bytes

Versions: 1

Compression:

Stored size: 874 Bytes

Contents

require 'rails_helper'

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

  feature 'confirmation' do
    background do
      visit nyauth.new_confirmation_request_path
    end

    scenario 'request & confirm' do
      fill_in('confirmation_request_email', with: user.email)
      click_button('request confirmation')

      open_email(user.email)
      current_email.click_link('confirm')

      expect(page).to have_content('confirmed')
      user.reload
      expect(user).to be_confirmed
    end

    scenario 'request expired' do
      fill_in('confirmation_request_email', with: user.email)
      click_button('request confirmation')

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

        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/confirmation_requests_spec.rb