Module: Billy
- Defined in:
- lib/billy.rb,
lib/billy/cache.rb,
lib/billy/proxy.rb,
lib/billy/rspec.rb,
lib/billy/config.rb,
lib/billy/railtie.rb,
lib/billy/version.rb,
lib/billy/cucumber.rb,
lib/billy/json_utils.rb,
lib/billy/proxy_connection.rb,
lib/billy/proxy_request_stub.rb
Defined Under Namespace
Modules: CucumberHelper, JSONUtils, RspecHelper
Classes: Cache, Config, Proxy, ProxyConnection, ProxyRequestStub, Railtie
Constant Summary
collapse
- VERSION =
"0.2.3"
Class Method Summary
collapse
Class Method Details
32
33
34
35
|
# File 'lib/billy/config.rb', line 32
def self.configure
yield config if block_given?
config
end
|
.log(*args) ⇒ Object
37
38
39
40
41
|
# File 'lib/billy/config.rb', line 37
def self.log(*args)
unless config.logger.nil?
config.logger.send(*args)
end
end
|
.proxy ⇒ Object
10
11
12
13
14
15
16
|
# File 'lib/billy.rb', line 10
def self.proxy
@billy_proxy ||= (
proxy = Billy::Proxy.new
proxy.start
proxy
)
end
|
.register_drivers ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/billy.rb', line 18
def self.register_drivers
['capybara/poltergeist', 'capybara/webkit', 'selenium/webdriver'].each do |d|
begin
require d
rescue LoadError
end
end
if defined?(Capybara::Poltergeist)
Capybara.register_driver :poltergeist_billy do |app|
options = {
phantomjs_options: [
'--ignore-ssl-errors=yes',
"--proxy=#{Billy.proxy.host}:#{Billy.proxy.port}"
]
}
Capybara::Poltergeist::Driver.new(app, options)
end
end
if defined?(Capybara::Webkit::Driver)
Capybara.register_driver :webkit_billy do |app|
driver = Capybara::Webkit::Driver.new(app)
driver.browser.set_proxy(:host => Billy.proxy.host,
:port => Billy.proxy.port)
driver.browser.ignore_ssl_errors
driver
end
end
if defined?(Selenium::WebDriver)
Capybara.register_driver :selenium_billy do |app|
profile = Selenium::WebDriver::Firefox::Profile.new
profile.proxy = Selenium::WebDriver::Proxy.new(
:http => "#{Billy.proxy.host}:#{Billy.proxy.port}",
:ssl => "#{Billy.proxy.host}:#{Billy.proxy.port}")
Capybara::Selenium::Driver.new(app, :profile => profile)
end
end
end
|