Sha256: 7580f42ddb2389fd41424dabbeca52e131bd8c59e9ce5db5dd9e76b594c9dffc

Contents?: true

Size: 544 Bytes

Versions: 1

Compression:

Stored size: 544 Bytes

Contents

<%- unless ModelBase.config.frozen_string_literal.nil? -%>
# frozen_string_literal: <%= ModelBase.config.frozen_string_literal.inspect %>
<%- end -%>
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

1 entries across 1 versions & 1 rubygems

Version Path
model_base_generators-0.4.0 lib/generators/model_base/templates/spec/support/controller_macros.rb