I'm new to writing tests in capybara and I'm having trouble getting the current URL of a page. I wrote it like this:
url = page.current_url + page.current_path
Somehow its just returning the base URL. Help is much appreciated.
I'm new to writing tests in capybara and I'm having trouble getting the current URL of a page. I wrote it like this:
url = page.current_url + page.current_path
Somehow its just returning the base URL. Help is much appreciated.
you could use have_current_path:
expect(page).to have_current_path(new_user_path)
before seeing that I was doing something like:
def current_path
current_uri = URI.parse(page.current_url)
current_path = current_uri.path
current_path += "?#{current_uri.query}" if current_uri.query.present?
current_path
end