2
votes

Here is my step, and capybara doesn't seem to escape it properly thats why it's showing as:

And I should see 'Height (e.g. 5\'11\")'

Then /^I should see 'Height (e.g. (\d+)\'(\d+)\")'$/ do |arg1, arg2| pending # express the regexp above with the code you wish you had end

I just need it to check the page if it has that string. Is this a capybara limitation? Or am I escaping it wrong?

1

1 Answers

4
votes

Looks like cucumber is unable to generate proper regexp for such string. But cucumber also works with Multiline Strings. So you can implement following code:

# web_steps.rb
Then /^(?:|I )should see following text:$/ do |text|
  page.should have_content(text)
end

# in your scenario
...
And I should see following text:
"""
Height (e.g. 5'11")
"""

It works to me. Hope it will help you too.