I'm starting to make BDD with cucumber.
I have written my first scenario like this
Scenario: ...
Given I am on the new event page
And I fill in "title" with "tata"
With these steps
Given /^I am on (.+)$/ do |page_name|
visit("/event/new")
end
When /^I fill in "([^\"]*)" with "([^\"]*)"$/ do |field, value|
fill_in(field.gsub(' ', '_'), :with => value)
end
It works good, nice. Now, I want to use the send function to visit a page. So I have changed the first step like this.
Given /^I am on (.+)$/ do |page_name|
self.send("new_event_path".to_sym)
end
The page is found but the fill_in does not work because an element is not found.
Unable to find field "title" (Capybara::ElementNotFound)
I don't understand why it's not working with the send function?