当我用stub_chain运行一个测试时,我会得到一个弃用警告。如何避免RSpec 3.0中的stub_chain的弃用警告?
describe "stubbing a chain of methods" do
subject { Object.new }
context "given symbols representing methods" do
it "returns the correct value" do
subject.stub_chain(:one, :two, :three).and_return(:four)
expect(subject.one.two.three).to eq(:four)
end
end
end
废弃警告: 从rspec的,嘲笑的老:should
语法使用stub_chain
不显式启用的语法已经过时了。改用新的:expect
语法或明确启用:should
。
如何避免此警告?
+1感谢您的澄清。完全错过了。 –
请参阅[相关的大约2015/2016的方式](http://stackoverflow.com/questions/28050261/issue-with-stubs-and-rspec-old-syntax)。 –