lib/capybara/poltergeist/browser.rb in poltergeist-0.2.0 vs lib/capybara/poltergeist/browser.rb in poltergeist-0.3.0
- old
+ new
@@ -2,13 +2,23 @@
module Capybara::Poltergeist
class Browser
attr_reader :options, :server, :client
+ DEFAULT_TIMEOUT = 30
+
def initialize(options = {})
@options = options
- @server = Server.new
+ @server = Server.new(options.fetch(:timeout, DEFAULT_TIMEOUT))
@client = Client.new(server.port, options[:phantomjs])
+ end
+
+ def timeout
+ server.timeout
+ end
+
+ def timeout=(sec)
+ server.timeout = sec
end
def restart
server.restart
client.restart