search for: from_block

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

Did you mean: frame_block
2007 Jul 16
4
Set the return value to "same as block"
...n value to be the same as the return value of the block. I am trying to test opening a file in a block and reading from it. It would be nice to use code like this: object.stubs(:open).with("/path/to/file", "r").yields( stub(:read => "The file contents") ).returns(from_block) Which would make open() take the return value of the block. So this app code would work: def my_method open("/path/to/file", "r") { |file| file.read } end and this wouldn''t work (because the return value of the block is not the contents of the file): def my_metho...