Permalink
Browse files

pulling info from Capybara.app_host for users willing to test externa…

…l apps
  • Loading branch information...
santiycr committed Jul 25, 2011
1 parent aae55b9 commit 60466a186b5f4ff9a79de398aeb95ca0b033b86c
Showing with 7 additions and 3 deletions.
  1. +7 −3 lib/sauce/capybara.rb
View
@@ -1,4 +1,7 @@
require 'capybara'
+require 'uri'
+
+$uri = URI.parse Capybara.app_host || ""
module Sauce
module Capybara
@@ -8,12 +11,13 @@ def browser
puts "[Connecting to Sauce OnDemand...]"
config = Sauce::Config.new
@domain = "#{rand(10000)}.test"
- @sauce_tunnel = Sauce::Connect.new(:host => "127.0.0.1",
- :port => rack_server.port,
+ @sauce_tunnel = Sauce::Connect.new(:host => $uri.host || rack_server.host,
+ :port => $uri.port || rack_server.port,
:domain => @domain,
:quiet => true)
@sauce_tunnel.wait_until_ready
- @browser = Sauce::Selenium2.new(:name => "Capybara", :browser_url => "http://#{@domain}")
+ @browser = Sauce::Selenium2.new(:name => "Capybara test",
+ :browser_url => "http://#{@domain}")
at_exit do
@browser.quit
@sauce_tunnel.disconnect

0 comments on commit 60466a1

Please sign in to comment.