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
을 말하고 무엇을 증류 한 예입니다 그리고 내가 rspec-mocks
에 TestDouble
클래스를 보면이 시험을
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
Proxy
's==
method를 참조하십시오? rspec 3.0처럼 보이지 않았다 –@DaneAndersen 잘 모르겠습니다. 나는 3.0에 없었던 것에 놀랐다 -'=='의 정의가 거의 3 년 동안 계속되었고, 3.0을위한 코드를 보면 여전히'other == __mock_proxy' 일을한다. –