title: How can I get the current hostname and port when running Capybara with Poltergeist?
body: <p>I have a test program that mimics a user's iOS device by sending chunks of data to a rails server.  This program works fine outside of testing.  Inside of testing, the program immediately times out since it cannot find the server.</p>
  
  <p>My configuration, in env.rb:</p>
  
  <pre><code>require 'capybara/poltergeist'
  Capybara.javascript_driver = :poltergeist
  Capybara.server_port = 3123
  Capybara.app_host = "http://0.0.0.0:3123"
  </code></pre>
  
  <p>Inside the test, I've tried things like</p>
  
  <pre><code>puts Capybara.current_session.current_host
  puts Capybara.current_session.current_url
  </code></pre>
  
  <p>and so forth, but those are all blank.  Doing:</p>
  
  <p>puts Capybara.current_session</p>
  
  <p>produces a memory address, so I know that the current session is working.  </p>
  
  <p>This is with Capybara set up like so in the gemfile:</p>
  
  <pre><code>gem 'capybara', '~&gt; 2.0.2
  </code></pre>
  
  <p>I've seen several questions based on this, but their answers just don't work for me.  Specifically, Capybara does not appear to be setting the current host or url as I've specified, nor is it actually allowing me to see the contents of the current session.  So how can I fix this and specify a particular port and url?</p>