Permalink
Browse files

Failing spec for issue 127.

  • Loading branch information...
1 parent f9c5d6a commit 3a804ff1df2d98baeb91650a1cbbd956086af966 @myronmarston myronmarston committed Dec 26, 2012
Showing with 13 additions and 0 deletions.
  1. +13 −0 spec/rspec/mocks/and_yield_spec.rb
@@ -5,6 +5,19 @@
let(:obj) { double }
describe "#and_yield" do
+ context 'when the method double has been constrained by `with`' do
+ it 'uses the default stub if the provided args do not match' do
+ obj.stub(:foo) { 15 }
+ obj.stub(:foo).with(:yield).and_yield
+
+ # should_receive is required to trigger the bug:
+ # https://github.com/rspec/rspec-mocks/issues/127
+ obj.should_receive(:foo)
+
+ expect(obj.foo(:dont_yield)).to eq(15)
+ end
+ end
+
context "with eval context as block argument" do
it "evaluates the supplied block as it is read" do

0 comments on commit 3a804ff

Please sign in to comment.