1
我不太确定为什么,但是我的Sinatra rspec测试不会在应该的时候正确地失败。这是我的Rspec的一部分:should_not_receive不会失败Class方法
context "invalid params" do
before do
@params = {}
end
it "does not call the Count model" do
Count.should_not_receive(:increment)
post '/counts' , @params
end
end
虽然没有失败。但是如果我切换should_not_receive行:
Failure/Error: Count.should_receive(:increment).exactly(2).times
(<Count (class)>).increment(any args)
expected: 2 times
received: 1 time
那么,为什么第一次测试没有,如果它被称为一次失败:
Count.should_receive(:increment).exactly(2).times
它与下面的错误响应?