I am using Rails 3 with Cucumber, Capybara and Factory_Girl. I am trying to test following the "Show" link for just one of the rows on an HTML table. I am using the syntax:
And I follow "Show" within "Net 30"
I gives me the following error:
unexpected '30' after 'DESCENDANT_SELECTOR' (Nokogiri::CSS::SyntaxError)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/racc/parser.rb:99:in `_racc_do_parse_c'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/racc/parser.rb:99:in `__send__'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/racc/parser.rb:99:in `do_parse'
./features/step_definitions/web_steps.rb:14:in `with_scope'
./features/step_definitions/web_steps.rb:34:in `/^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/'
features/view_payment_terms.feature:10:in `And I follow "Show" within "Net 30"'
Here is the full Cucumber script that fails:
Feature: View Payment Terms
In order to view payment terms
As a user
I want to view payment terms
Scenario: View Payment Terms
Given there is a payment term named "Net 30"
And there is a payment term named "Net 60"
When I go to the "payment terms screen"
And I follow "Show" within "Net 30"
Then I should see "Terms description: Net 30"
If I change that line to just say:
And I follow "Show"
It passes with no errors. I looked in the web_steps.rb that came with Capybara and what I am using appears to be correct:
When /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector|
with_scope(selector) do
click_link(link)
end
end