【发布时间】:2018-07-18 13:48:33
【问题描述】:
我正在使用 cucumber 和 capybara、rspec 助手来编写测试用例。
当我使用 have_content 验证特定页面中是否存在文本时,即使页面中存在内容也会引发错误。
我的功能文件是
When I visit "/news"
Then I should not see a page with following content
| content |
| .*Confirm your email address now.* |
步骤定义文件是
Then /^I should see a page with following content$/ do |table|
table.hashes.each do |hash|
page.should have_content(hash[:content])
end
end
我得到的错误是
RSpec::Expectations::ExpectationNotMetError: 期望找到文本 “。立即确认您的电子邮件地址。”在“The North FaceBanana”中 共和国列维萨迪达斯真正的宗教J。拉尔夫的 CrewJordanPolo 劳伦儿童品牌GAPCCarter'sNikeChildren's Place GymboreeOshKosh B'goshConverse拉尔夫劳伦正义老海军人也 搜索维多利亚的秘密Christian LouboutinGoyardForever 21AsosParties它是如何工作的在 Poshmark 上销售新闻所有评论优惠想要 卖你的东西?在您的移动设备上下载 Poshmark!确认您的 现在的电子邮件地址,以确保您收到重要的订单和帐户 信息。”
我要查找的文本也出现在页面中。
如果我在某个地方错了,请帮助我..
提前致谢。
【问题讨论】:
标签: ruby-on-rails ruby rspec cucumber capybara