Sha256: d9a61400efb9c27fe2a48252b00fa03fe9a39ded38e7b4e7771861535e2065e2

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

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

  def login_librarian
    before(:each) do
      @request.env['devise.mapping'] = Devise.mappings[:librarian]
      sign_in FactoryGirl.create(:librarian)
    end
  end

  def login_user
    before(:each) do
      @request.env['devise.mapping'] = Devise.mappings[:user]
      sign_in FactoryGirl.create(:user)
    end
  end

  def login_fixture_admin
    before(:each) do
      @request.env['devise.mapping'] = Devise.mappings[:admin]
      @user = users(:admin)
      sign_in @user
    end
  end

  def login_fixture_librarian
    before(:each) do
      @request.env['devise.mapping'] = Devise.mappings[:librarian]
      @user = users(:librarian1)
      sign_in @user
    end
  end

  def login_fixture_user
    before(:each) do
      @request.env['devise.mapping'] = Devise.mappings[:user]
      @user = users(:user1)
      sign_in @user
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
enju_seed-0.3.0.beta.4 spec/support/controller_macros.rb
enju_seed-0.3.0.beta.3 spec/support/controller_macros.rb
enju_seed-0.3.0.beta.2 spec/support/controller_macros.rb
enju_seed-0.3.0.beta.1 spec/support/controller_macros.rb