On Wednesday, 14 November 2012 00:02:51 UTC+1, Daniel Doubrovkine wrote:
> I'm trying to test some of this with Capybara. Ideally I'd like to be able
> to introduce a second host into the tests, for example on my local
> environment I have
http://localhost:3000 and
http://local.art.sy:3000that are the same thing. For Capybara I am thinking I can do
>
http://127.0.0.1:1234 vs.
http://localhost:1234.
> My questions are:
> 1. How do I get the full URL to which to set the redirect before I
> open a browser (I can get current_url, but it's too late then). What does
> Capybara user internally when you do "visit X"?
That depends on the driver. For Rack-Test
see lib/capybara/rack_test/driver.rb & lib/capybara/rack_test/browser.rb I
assume if you're trying to test CORS you're using a real browser through
Selenium or Poltergeist. Either way, setting Capybara.app_host =
"
http://test.local.artsy:3000/" will work for you for the main URL. If you
use config or environment variables to hold the main and login hosts then
you can set them to special values for your tests, and you'll know what
URLs to expect.
Matt