我的测试文件中有:
controller.request.stub referer: 'bla'这将生成弃用警告:
Using `stub` from rspec-mocks' old `:should` syntax without explicitly enabling the syntax is deprecated. Use the new `:expect` syntax or explicitly enable `:should` instead.在控制器规格中设置request.referrer的正确方法是什么?提前谢谢。
发布于 2017-03-04 01:35:22
试试allow(controller.request).to receive(:referer).and_return('bla')
正如警告所述,.stub语法已弃用。
https://stackoverflow.com/questions/42554923
复制相似问题