开发者

How to strip a quote in a Cucumber Then-Step?

开发者 https://www.devze.com 2023-01-08 08:10 出处:网络
i want to strip a quote in the following cucumber expression, but i get unknown step error Then I should see \"[\\\"20257\\\"]\\n\"

i want to strip a quote in the following cucumber expression, but i get unknown step error

Then I should see "[\"20257\"]\n"

Cucumber suggested me this :(

Then /^I should see "([^"]*)"(\d+)\\"([^"]*)"$/ do |arg1, arg2, arg3|
  pending # express t开发者_C百科he regexp above with the code you wish you had
end

Any ideas, how to strip in this step?


How about writing:

Then I should see "["20257"]\n"

With the step being:

Then /^I should see "(.*)"$/ do |txt|
  txt.gsub!('\n', "\n")
  # ...
end

Or you could use the multiline argument """ and not even have to worry about the \n substitution.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号