2014-09-10 88 views
4

我升級我們的代碼庫使用rspec的3.1.0,並在此之後的文檔後錯誤: https://relishapp.com/rspec/docs/upgraderspec`with`必須至少有一個參數。升級到3.1.0

一個現有的測試運行我以後transpec收到以下錯誤的。

with必須至少有一個參數,使用no_args匹配器來設置接收沒有參數的期望。

這是測試。

it 'does something' do 
    expect(my_method).to receive(:resource) 
     .with { |path| path.include? 'test' }.and_return({}) 
    end 

新的synatx是否不再受到阻擋?

+0

什麼是'my_method'?什麼是「資源」方法定義?請向我們展示您正在測試的代碼。 – 2014-09-11 05:39:24

+0

您升級哪種版本的RSpec? – 2014-09-11 16:33:17

回答

1

這已在版本2.99中棄用,並在rspec 3中刪除。您可以在此處看到詳細信息:https://github.com/rspec/rspec-mocks/issues/377

可以完成與相同的測試:

it 'does something' do 
    expect(my_object).to receive(:resource).with(/test/).and_return({}) 
end 
相關問題