blob: 1d3681ab50327778af2688c42a9a5964ae011a83 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
require_relative '../../../spec_helper'
describe "Enumerator::Yielder#to_proc" do
it "returns a Proc object that takes an argument and yields it to the block" do
ScratchPad.record []
y = Enumerator::Yielder.new { |*args| ScratchPad << args; "foobar" }
callable = y.to_proc
callable.class.should == Proc
result = callable.call(1, 2)
ScratchPad.recorded.should == [[1, 2]]
result.should == "foobar"
end
end
|