I’m learning to test with cucumber + capybara.
In one video tutorial I found that something like this should work:
...
When I go to the homepage
Then /do stuff/
I’m trying to do that but cucumber treats the word “homepage” as a part of regex.
So it gives me the suggestion to create a statement like so
When /^I go to homepage$/ do
#tasks
end
Tried “index page”, “items page” (name of existing controller), “root path” – same thing. Cucumber doesn’t actually go there – just asks to create a handler.
Where do I go from here?
Using a gem such as Capybara you could do something like so
In you test:
In your step:
Or to generalize:
where your step would pass in the location (url) where you would want to go.
For more info on
visitmethod checkout here