我明白了,不是Watir和rspec一起找到我的短信。以下代码将导致此错误。
browser.text.include?("Coverberechnung").should == trueexpected: true got: false (using ==)Using should from rspec-expectations' old :should syntax without explicitly enabling the syntax is deprecated. Use the new :expect syntax or explicitly enable :should instead. Called from也许我能帮上忙
网站网址:在这里输入链接描述
发布于 2014-06-12 16:55:03
您正在寻找一个最初大写的字符串(即Coverberechnung),但是该字符串在测试站点上是全部大写的(即COVERBERECHNUNG)。
尝试:
browser.text.include?("COVERBERECHNUNG").should == true
或(使用期望语法)
expect(browser.text.include?("COVERBERECHNUNG")).to be true
发布于 2016-01-14 14:29:50
我更喜欢使用expect(browser.text).to include('coverberechnung')
发布于 2015-08-05 19:22:56
如果我想对案子漠不关心,我会这样做:
browser.text.upcase.include?("COVERBERECHNUNG").should == true或
browser.text.downcase.include?("coverberechnung").should == true这样,您可以避免文本比较可能有不同的情况。
还有最后一个问题#3:使用
expect(browser.text.downcase.include?("coverberechnung")).to be true他们不久前反对那个版本。所以你可以在没有问题的情况下试一试。
注意到:只有一个警告是,这将忽略情况。如上文所述。
https://stackoverflow.com/questions/24188892
复制相似问题