Sha256: a371aac159cc6891bc3312284ef7abd4562e5113d836b81b6e6c86980aba29c8

Contents?: true

Size: 416 Bytes

Versions: 2

Compression:

Stored size: 416 Bytes

Contents

if defined? Devise
  def log_in(user, options = {})
    initial_path = options.fetch(:initial_path, :root_path)
    visit send(initial_path, :auth_token => user.authentication_token)
  end

  def log_out
    visit destroy_user_session_path
  end
end

def authenticate_api_as(user)
  auth_token = user.respond_to?(:auth_token) ? user.auth_token : user

  request.env['HTTP_AUTHORIZATION'] = "Token #{auth_token}"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspectacular-0.23.1 lib/rspectacular/helpers/session_helpers.rb
rspectacular-0.23.0 lib/rspectacular/helpers/session_helpers.rb