Sha256: 1ed96619fbcf7a0be4bb368682549c2b3c65fb47ad5151e59b5dde7ff77b4480

Contents?: true

Size: 424 Bytes

Versions: 2

Compression:

Stored size: 424 Bytes

Contents

# frozen_string_literal: true
module ControllerMacros
  def devise_login(key, user)
    @request.env['devise.mapping'] = Devise.mappings[key]
    sign_in(user)
  end

  def devise_user_login(user)
    devise_login(:user, user)
  end

  def login_admin
    before(:each) { devise_login(:admin, FactoryBot.create(:admin)) }
  end

  def login_user
    before(:each) { devise_login(:user, FactoryBot.create(:user)) }
  end
end

Version data entries

2 entries across 1 versions & 1 rubygems

Version Path
model_base_generators-0.4.0 examples/rails-5.0/spec/support/controller_macros.rb
model_base_generators-0.4.0 examples/rails-5.1/spec/support/controller_macros.rb