Sha256: 3729dd4c9837cfb18e231c68cf115d4c2b0587ecfc0c06f95ad1c3d1a3cd9da8

Contents?: true

Size: 1.03 KB

Versions: 64

Compression:

Stored size: 1.03 KB

Contents

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

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

  def login_user
    before(:each) do
      @request.env["devise.mapping"] = Devise.mappings[:user]
      user = Factory.create(:user)
      sign_in 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[:user]
      @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

64 entries across 64 versions & 12 rubygems

Version Path
enju_event-0.0.3 spec/support/controller_macros.rb
enju_circulation-0.0.3 spec/support/controller_macros.rb
enju_question-0.0.3 spec/support/controller_macros.rb
enju_subject-0.0.4 spec/support/controller_macros.rb