diff options
Diffstat (limited to 'spec/ruby/core/array/new_spec.rb')
-rw-r--r-- | spec/ruby/core/array/new_spec.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/spec/ruby/core/array/new_spec.rb b/spec/ruby/core/array/new_spec.rb index d5e4b5722f..96ec6b8198 100644 --- a/spec/ruby/core/array/new_spec.rb +++ b/spec/ruby/core/array/new_spec.rb @@ -11,10 +11,10 @@ describe "Array.new" do end it "raises an ArgumentError if passed 3 or more arguments" do - lambda do + -> do [1, 2].send :initialize, 1, 'x', true end.should raise_error(ArgumentError) - lambda do + -> do [1, 2].send(:initialize, 1, 'x', true) {} end.should raise_error(ArgumentError) end @@ -26,7 +26,7 @@ describe "Array.new with no arguments" do end it "does not use the given block" do - lambda{ Array.new { raise } }.should_not raise_error + ->{ Array.new { raise } }.should_not raise_error end end @@ -37,7 +37,7 @@ describe "Array.new with (array)" do end it "does not use the given block" do - lambda{ Array.new([1, 2]) { raise } }.should_not raise_error + ->{ Array.new([1, 2]) { raise } }.should_not raise_error end it "calls #to_ary to convert the value to an array" do @@ -54,7 +54,7 @@ describe "Array.new with (array)" do end it "raises a TypeError if an Array type argument and a default object" do - lambda { Array.new([1, 2], 1) }.should raise_error(TypeError) + -> { Array.new([1, 2], 1) }.should raise_error(TypeError) end end @@ -74,12 +74,12 @@ describe "Array.new with (size, object=nil)" do end it "raises an ArgumentError if size is negative" do - lambda { Array.new(-1, :a) }.should raise_error(ArgumentError) - lambda { Array.new(-1) }.should raise_error(ArgumentError) + -> { Array.new(-1, :a) }.should raise_error(ArgumentError) + -> { Array.new(-1) }.should raise_error(ArgumentError) end it "raises an ArgumentError if size is too large" do - lambda { Array.new(fixnum_max+1) }.should raise_error(ArgumentError) + -> { Array.new(fixnum_max+1) }.should raise_error(ArgumentError) end it "calls #to_int to convert the size argument to an Integer when object is given" do @@ -97,7 +97,7 @@ describe "Array.new with (size, object=nil)" do it "raises a TypeError if the size argument is not an Integer type" do obj = mock('nonnumeric') obj.stub!(:to_ary).and_return([1, 2]) - lambda{ Array.new(obj, :a) }.should raise_error(TypeError) + ->{ Array.new(obj, :a) }.should raise_error(TypeError) end it "yields the index of the element and sets the element to the value of the block" do @@ -105,7 +105,7 @@ describe "Array.new with (size, object=nil)" do end it "uses the block value instead of using the default value" do - lambda { + -> { @result = Array.new(3, :obj) { |i| i.to_s } }.should complain(/block supersedes default value argument/) @result.should == ['0', '1', '2'] |