2017-03-02 44 views
0

我有正確的語法:RSpec的 - 在我的測試文件中設置request.referrer

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的正確方法在控制器規格?提前致謝。

回答

0

嘗試allow(controller.request).to receive(:referer).and_return('bla')

爲警告說,.stub語法棄用。