Port of the Rails app when running Cucumber tests
cucumber, port, ruby-on-rails, testing
Solution
When using the selenium driver, the port can be found on:
Capybara.current_session.driver.rack_server.port
and when using the webkit driver, it can be found on:
Capybara.current_session.driver.server_port
Alternative, you can set
Capybara.server_port
to a known value and use that.
Problem
Is there a way to get, in the test, the port in which the rails app is running during cucumber test? I tried Capybara.server_port but that's nil. Thanks.