0
我有一个测试,我正在与此工作意外失败。它是说==会在double上调用两次。是否因为它也是该方法的一个论据?为什么rspec双打收到:==两次
这就是我讲的
require 'rspec'
describe 'rspec test doubles' do
let(:a_double) { double('a_double') }
it 'should only call == once' do
expect(a_double).to receive(:==).and_return(true)
a_double == a_double
end
end
的蒸馏的例子,这是我所得到的,当我运行这个测试
F
Failures:
1) rspec test doubles should only call == once
Failure/Error: expect(watir_driver).to receive(:==).and_return(true)
(Double "watir_driver").==(*(any args))
expected: 1 time with any arguments
received: 2 times with any arguments
# ./double_spec.rb:7:in `block (2 levels) in <top (required)>'
Finished in 0.019 seconds (files took 0.26902 seconds to load)
1 example, 1 failure
Failed examples:
rspec ./double_spec.rb:6 # rspec test doubles should only call == once
你知道,当他们开始表现呀?它看起来像rspec 3.0没有 – 2015-02-06 16:10:04
@DaneAndersen我不知道。我很惊讶它没有在3.0中 - '=='的定义已经存在了将近3年了,并且查看3.0的代码,它仍然执行'other == __mock_proxy'的事情。 – 2015-02-06 16:21:47