search for: processorengin

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

Did you mean: processorengine
2007 Mar 07
0
Simulate an enumerable with a mock
I need to simulate an enumerable class (well, it has one method: each). The code looks something like this OTTOMH: class Processor def initialize(input, output) @input = input; @output = output end def run @input.each do |row| @output << ProcessorEngine.new(row).process end end end This is the best I could come up with: @input = mock("input") class << @input def each [ [:a], [:b] ].each do |value| yield value end end end But that seems like adding behaviou...