Sha256: 3c268fefcb94bc3da937fe7dfce747c069cbb6a4d64f58751fddb9cbaeec41af

Contents?: true

Size: 967 Bytes

Versions: 8

Compression:

Stored size: 967 Bytes

Contents

module ControllerMacros
  # def login_admin
  #   before(:each) do
  #     @request.env["devise.mapping"] = Devise.mappings[:admin]
  #     sign_in FactoryGirl.create(:admin) # Using factory girl as an example
  #   end
  # end

  def login_non_admin_user
    before(:each) do
      @request.env["devise.mapping"] = Devise.mappings[:user]
      user = FactoryGirl.create(:pwb_user, email: 'non_admin@pwb.com', password: '123456', admin: false)
      # user.confirm! # or set a confirmed_at inside the factory. Only necessary if you are using the "confirmable" module
      sign_in user
    end
  end

  def login_admin_user
    before(:each) do
      @request.env["devise.mapping"] = Devise.mappings[:user]
      user = FactoryGirl.create(:pwb_user, email: 'admin@pwb.com', password: '123456', admin: true)
      # user.confirm! # or set a confirmed_at inside the factory. Only necessary if you are using the "confirmable" module
      sign_in user
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pwb-1.4.0 spec/support/controller_macros.rb
pwb-1.3.0 spec/support/controller_macros.rb
pwb-1.2.0 spec/support/controller_macros.rb
pwb-1.1.1 spec/support/controller_macros.rb
pwb-1.0.0 spec/support/controller_macros.rb
pwb-0.1.1 spec/support/controller_macros.rb
pwb-0.1.0 spec/support/controller_macros.rb
pwb-0.0.2 spec/support/controller_macros.rb