Sha256: 1e2dc2cedb9290ee8216d43fca38ebbb8ed7059dc720093325175b382bc95f4f

Contents?: true

Size: 577 Bytes

Versions: 6

Compression:

Stored size: 577 Bytes

Contents

module ControllerHelper
  def sign_in(user = create_user('not_encrypted'))
    allow(warden).to receive(:authenticated?).with(:user).and_return(true)
    allow(controller).to receive(:current_user).and_return(user)
    warden.session(:user)[DeviseXfactorAuthentication::NEED_AUTHENTICATION] = true
  end
end

RSpec.configure do |config|
  config.include Devise::Test::ControllerHelpers, type: :controller
  config.include ControllerHelper, type: :controller

  config.before(:example, type: :controller) do
    @request.env['devise.mapping'] = Devise.mappings[:user]
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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