I have some rails app, a view with a field, lets say its called ‘some_field’
I want to fill in in the field ‘”SOME_STRING_WITH_QUOTES”‘
How can I do this in cucumber?
When I fill in "some_field" with ""SOME_STRING""
When I fill in "some_field" with "\"SOME_STRING\""
dont work (the cucumber parser doesnt seem to approve)
What to do? Its not some sort of matcher, so a regex wont work neither
When you write a step in your cucumber scenario, Cucumber suggests you the standard regex to match text inside the double quotes (regular expression [^”]* means a sequence of 0 or more characters of any kind, except ” character). So for
When I fill in "some_field" with: "SOME_STRING"it will suggest the following step definition:But you are not forced to use this regex and free to write any matcher you want. For example the following matcher will match any string that follows after colon and ends at the line end (and this string may include quotes):
Then your scenario step will look like this:
Update
You can also use Cucumber’s Multiline String in your Scenario step:
And then you won’t need to change step definition generated by Cucumber:
Your string with quotes will be passed as a last argument. In my opinion this approach looks heavier than the first one.