module Capybara::Apparition::Browser::Auth

Public Instance Methods

set_http_auth(user, password) click to toggle source
# File lib/capybara/apparition/browser/auth.rb, line 10
def set_http_auth(user, password)
  set_auth(:http, user, password)
end
set_proxy_auth(user, password) click to toggle source
# File lib/capybara/apparition/browser/auth.rb, line 6
def set_proxy_auth(user, password)
  set_auth(:proxy, user, password)
end

Private Instance Methods

set_auth(type, user, password) click to toggle source
# File lib/capybara/apparition/browser/auth.rb, line 16
def set_auth(type, user, password)
  creds = user.nil? && password.nil? ? nil : { username: user, password: password }

  case type
  when :http
    current_page.credentials = creds
  when :proxy
    @proxy_auth = creds
  end
end