class Rack::Test::Session

def basic_authorize(username, password)

basic_authorize "bryan", "secret"
Example:

included in subsequent requests in the HTTP_AUTHORIZATION header.
Set the username and password for HTTP Basic authorization, to be
def basic_authorize(username, password)
  encoded_login = ["#{username}:#{password}"].pack('m0')
  header('Authorization', "Basic #{encoded_login}")
end