Sha256: 472a49352196a2235e7d4f1ca9ef8a9f1750d9a520747c6a229216446f826d7d

Contents?: true

Size: 426 Bytes

Versions: 6

Compression:

Stored size: 426 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, FactoryGirl.create(:admin)) }
  end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
model_base_generators-0.3.9 example/spec/support/controller_macros.rb
model_base_generators-0.3.8 example/spec/support/controller_macros.rb
model_base_generators-0.3.7 example/spec/support/controller_macros.rb
model_base_generators-0.3.6 example/spec/support/controller_macros.rb
model_base_generators-0.3.5 example/spec/support/controller_macros.rb
model_base_generators-0.3.4 example/spec/support/controller_macros.rb