Sha256: d05d0d354d6f2ae9fed33fb4a1dee89e1e2f08a45aba63c9734635ad6edaa53e

Contents?: true

Size: 909 Bytes

Versions: 6

Compression:

Stored size: 909 Bytes

Contents

require 'warden'

module FeaturesSpecHelper
  def warden
    request.env['warden']
  end

  def complete_sign_in_form_for(user)
    fill_in "Email", with: user.email
    fill_in "Password", with: 'password'
    find('.actions input').click # 'Sign in' or 'Log in'
  end

  def set_cookie key, value
    page.driver.browser.set_cookie [key, value].join('=')
  end

  def get_cookie key
    Capybara.current_session.driver.request.cookies[key]
  end

  def set_tfa_cookie value
    set_cookie DeviseXfactorAuthentication::REMEMBER_TFA_COOKIE_NAME, value
  end

  def get_tfa_cookie
    get_cookie DeviseXfactorAuthentication::REMEMBER_TFA_COOKIE_NAME
  end
end

RSpec.configure do |config|
  config.include Warden::Test::Helpers, type: :feature
  config.include FeaturesSpecHelper, type: :feature

  config.before(:each) do
    Warden.test_mode!
  end

  config.after(:each) do
    Warden.test_reset!
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
devise_xfactor_authentication-2.2.23 spec/support/features_spec_helper.rb
devise_xfactor_authentication-2.2.22 spec/support/features_spec_helper.rb
devise_xfactor_authentication-2.2.21 spec/support/features_spec_helper.rb
devise_xfactor_authentication-2.2.20 spec/support/features_spec_helper.rb
devise_xfactor_authentication-2.2.19 spec/support/features_spec_helper.rb
devise_xfactor_authentication-2.2.18 spec/support/features_spec_helper.rb