0

我在我的场景中有这条线,第二条失败了:

Then I should see "blogger_1"
And I should not see "blogger_2"

And I should not see "blogger_2"                                        # features/step_definitions/web_steps.rb:147
  expected #has_no_content?("blogger_2") to return true, got false (RSpec::Expectations::ExpectationNotMetError)
  ./features/step_definitions/web_steps.rb:149:in `/^(?:|I )should not see "([^"]*)"$/'
  features/merge_articles.feature:46:in `And I should not see "blogger_2"'

有一个来自 cpybara 的保存页面:

http://ge.tt/3VNhKDS/v/0

4

2 回答 2

0

我已经做了这个步骤定义来检查那个单词不在表格单元格中

Then /^(?:|I )should not see "([^"]*)" in table$/ do |text|
  regexp = Regexp.new('<td>'+text+'</td>')
  assert page.body =~ regexp ? false : true
end
于 2012-11-24T09:13:28.687 回答
0

似乎您的 html 选项中出现了 blogger_2,因此您需要更复杂的定义来检查正确位置的文本,例如https://makandracards.com/makandra/5793-test-whether-a-form-现场存在黄瓜和水豚

于 2012-11-23T17:33:37.880 回答