Sha256: 2b888a74ad7b283944b3ffc8d87d7689f6c5b55718c8ab5db392d0e427bcf70a

Contents?: true

Size: 401 Bytes

Versions: 3

Compression:

Stored size: 401 Bytes

Contents

module AuthenticatedTestHelper
  # Sets the current account in the session from the account fixtures.
  def login_as(account)
    @request.session[:account_id] = account ? accounts(account).id : nil
  end

  def authorize_as(account)
    @request.env["HTTP_AUTHORIZATION"] = account ? ActionController::HttpAuthentication::Basic.encode_credentials(accounts(account).login, 'monkey') : nil
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
emergent-core-0.1.0 rails_generators/emergent_config/templates/lib/authenticated_test_helper.rb
emergent-core-0.1.02 rails_generators/emergent_config/templates/lib/authenticated_test_helper.rb
emergent-core-0.1.01 rails_generators/emergent_config/templates/lib/authenticated_test_helper.rb