search for: read_stack

Displaying 1 result from an estimated 1 matches for "read_stack".

2007 Nov 01
2
Can''t use #exactly when #and_return influences it.
...r enough: #spec_reader.rb describe Reader do it "should stop reading items when called with a limit" do @stack = mock(Stack) Stack.should_receive(:new).and_return(@stack) @stack.should_receive(:read).exactly(3).times.and_return(2,4,1,5,3,1,false) @reader = Reader.new @reader.read_stack(3) end end # reader.rb class Reader def initialize @stack = Stack.new end def read_stack(limit = 0) #0 = read until false is returned while val = @stack.read # Not implemented on purpose! # return if limit == 0 # limit -= limit ... end end So the test should fail, because t...