[RSpec][2.14rc1] Inconsistent results
Created by: conradwt
I'm getting a failing spec when using the new expect syntax:
require 'rspec/autorun'
class Teacher
def give_detention
call_parent( :warning )
end
def call_parent( message )
end
end
describe Teacher do
it 'old style mock' do
teacher = Teacher.new
Teacher.any_instance.should_receive(:call_parent).with( :warning )
teacher.give_detention
end
it 'new style mock' do
teacher = Teacher.new
expect( Teacher.any_instance ).to receive(:call_parent).with( :warning )
teacher.give_detention
end
end
$ rspec teacher_spec.rb
1) Teacher new style mock
Failure/Error: expect( Teacher.any_instance ).to receive(:call_parent).with( :warning )
(#<RSpec::Mocks::AnyInstance::Recorder:0x007f96dabe4588>).call_parent(:warning)
expected: 1 time with arguments: (:warning)
received: 0 times with arguments: (:warning)
# ./teacher_spec.rb:26:in `block (2 levels) in <top (required)>'
Finished in 0.00417 seconds
2 examples, 1 failure
Failed examples:
rspec ./teacher_spec.rb:23 # Teacher new style mock
Here's the version information:
$ rspec -v 2.14.0.rc1