Search code examples
ruby-on-railsrubycucumberbdd

Cucumber+Capybara: Problem with a scenario that redirects the browser outside of my app


Given I have a rails app
And I'm using cucumber
And I'm using capybara
And I have an action that results in a redirect_to "http://some.other.domain.com/some_path"
When I test this action
Then the in-app portion of the test works fine
But I see this error: No route matches "/some_path" with {:method=>:get} (ActionController::RoutingError)

So capybara is properly redirected to "http://some.other.domain.com/some_path" but for some reason it thinks it should handle the path portion of the url inside my app. NOTE capybara has no problem at all with "http://some.other.domain.com/" -- my tests pass if I redirect to a url without a path portion.

Is this a bug?


Solution

  • Which driver are you using? The Rack-Test driver isn't going to allow you to request stuff from other domains. If Capybara is doing this with Selenium or Culerity, it's definitely a bug. If you want to help out in getting it fixed, writing a failing spec would be very appreciated :)