Hello,

Something I do often is use stub methods in before blocks and mock
expectations in a specific examples (much like described here:
http://blog.davidchelimsky.net/2006/11/9/tutorial-rspec-stubs-and-mocks).

I was just surprised with an instance of doing this and I thought I'd check
with the group to see if I shouldn't have been.

What should be the expected output of the following -- assume it's the only
code in a spec file:

  class Foo; def bar; end; end

  it "should print something" do
    foo = Foo.new
    foo.stub!(:bar).and_return(true)
    foo.should_receive(:bar).at_least(:once).and_return(false)
    puts foo.bar
    puts foo.bar
  end

I expected "false / false". The actual output is "false / true".

Jeff
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to