Sha256: b09a8af992242c5f327c1d4ec1d343dc1f632767d1b624da9a79f6ebb210024b
Contents?: true
Size: 808 Bytes
Versions: 4
Compression:
Stored size: 808 Bytes
Contents
module AuthSpec def http_basic_login! request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials('usuario', 'senha') end end module CapybaraAuthSpec def http_basic_login! name = 'usuario' password = 'senha' if page.driver.respond_to?(:basic_auth) page.driver.basic_auth(name, password) elsif page.driver.respond_to?(:basic_authorize) page.driver.basic_authorize(name, password) elsif page.driver.respond_to?(:browser) && page.driver.browser.respond_to?(:basic_authorize) page.driver.browser.basic_authorize(name, password) else fail "I don't know how to log in!" end end end RSpec.configure do |config| config.include AuthSpec, type: :controller config.include CapybaraAuthSpec, type: :request end
Version data entries
4 entries across 4 versions & 1 rubygems