Have you ever wanted to put a comment on the same line as a cucumber step?
And I should see "M666" # local_id
And I should see "1977-1997" # create date
It just occurred to me that I could create a step definition to allow this:
# 'I should see "text"' step with comment at end of line
Then /^I should see "([^"]*)"(?: +\#.*)$/ do |text|
Given "I should see \"#{text}\""
end
If your text could include escaped quotes, you can use this step definition:
# 'I should see "text"' step with comment at end of line
Then /^I should see "(.*?)"(?: +\#.*)$/ do |text|
text.gsub!(/\\"/, '"')
assert page.has_content?(text)
end