then 子句黄瓜中不明确的正则表达式文字猎犬错误

Ambiguous regexp literal hounds error in then clause cucumber

Then /I see overlap exception/ do
  error_div = find('.alert')
  error_div.has_content? 'Capacity Commitment can not overlap other period'
end

Hounds 抛出如下错误:

不明确的正则表达式文字。如果确实是正则表达式文字,请将方法参数括起来,或者如果它应该是除法,则在 / 的右侧添加一个空格。

我使用 cucumber features/account_management/participant_accounts.feature --strict 但没有发现错误并且测试成功通过。

我们需要为字符串匹配使用特定格式:

Then /^I see overlap text$/ do
  error_div = find('.alert')
  error_div.has_content? 'Capacity Commitment can not overlap other period'
end