Sha256: a0b60732dc808e57a82a26417731b15a793857389fecb2f318a1f91731b629aa

Contents?: true

Size: 482 Bytes

Versions: 5

Compression:

Stored size: 482 Bytes

Contents

module ControllerMacros
  def login_admin
    before(:each) do
      @request.env["devise.mapping"] = Devise.mappings[:user]
      sign_in FactoryBot.create(:admin)
    end
  end

  def login_customer
    before(:each) do
      @request.env["devise.mapping"] = Devise.mappings[:user]
      customer = FactoryBot.create(:customer)
      # customer.confirm!
      sign_in customer
    end
  end
end

RSpec.configure do |config|
  config.extend ControllerMacros, type: :controller
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tang-0.2.1 spec/support/controller_macros.rb
tang-0.2.0 spec/support/controller_macros.rb
tang-0.1.0 spec/support/controller_macros.rb
tang-0.0.9 spec/support/controller_macros.rb
tang-0.0.8 spec/support/controller_macros.rb