Sha256: 49c6218cadced4e5fc5a60a8181d50f740ee5bc9609441f0e2564e20ff0f6c23
Contents?: true
Size: 1.15 KB
Versions: 83
Compression:
Stored size: 1.15 KB
Contents
require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/../spec_helper' require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/fixtures/block' describe "A block with a 'rest' arg" do it "collects all of the arguments passed to yield" do ret = nil BlockSpecs::Yield.new.splat(1,2,3) {|*args| ret = args} ret.should == [1,2,3] end end describe "A block with an anonymous 'rest' arg" do it "ignores all of the arguments passed to yield" do ret = [1].each {|*| } ret.should == [1] end end describe "A block whose arguments are splatted" do it "captures the arguments passed to the block in an array" do a = [] BlockSpecs::Yield.new.two_args { |*args| a << args } a.should == [[1, 2]] end it "captures the array passed to the block in an array" do a = [] BlockSpecs::Yield.new.two_arg_array { |*args| a << args } a.should == [[[1, 2]]] end it "yields the correct arguments in a nested block" do a = [] BlockSpecs::Yield.new.yield_splat_inside_block {|a1, a2| a << [a1, a2]} a.should == [[1, 0], [2, 1]] end end language_version File.join(__rhoGetCurrentDir(), __FILE__), "block"
Version data entries
83 entries across 83 versions & 1 rubygems