使用 RSpec 3.7.0。我想知道是否写作
expect(instance).not_to receive(:method)
与写作完全相同
expect(instance).to receive(:method).never
或者是否存在任何(甚至是细微的)差异或副作用。
最佳答案
根据此链接 https://github.com/rspec/rspec-mocks/issues/895 如果调用方法,您可以使用其中任何一个来导致示例失败 作者@myronmarston 也提供了一个例子
关于ruby - 是接收(:method). 从不完全等同于 not_to 接收(:方法),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50131739/