From 9f477803cd2ab1f27ffad0532982d43e19772170 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Fri, 8 May 2026 01:30:48 +0200 Subject: Update to ruby/spec@680fc69 --- spec/ruby/core/array/initialize_spec.rb | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'spec/ruby/core/array/initialize_spec.rb') diff --git a/spec/ruby/core/array/initialize_spec.rb b/spec/ruby/core/array/initialize_spec.rb index b9fa77b16e..19ee37825e 100644 --- a/spec/ruby/core/array/initialize_spec.rb +++ b/spec/ruby/core/array/initialize_spec.rb @@ -7,7 +7,7 @@ describe "Array#initialize" do end it "is private" do - Array.should have_private_instance_method("initialize") + Array.private_instance_methods(false).should.include?(:initialize) end it "is called on subclasses" do @@ -19,26 +19,26 @@ describe "Array#initialize" do it "preserves the object's identity even when changing its value" do a = [1, 2, 3] - a.send(:initialize).should equal(a) + a.send(:initialize).should.equal?(a) a.should_not == [1, 2, 3] end it "raises an ArgumentError if passed 3 or more arguments" do -> do [1, 2].send :initialize, 1, 'x', true - end.should raise_error(ArgumentError) + end.should.raise(ArgumentError) -> do [1, 2].send(:initialize, 1, 'x', true) {} - end.should raise_error(ArgumentError) + end.should.raise(ArgumentError) end it "raises a FrozenError on frozen arrays" do -> do ArraySpecs.frozen_array.send :initialize - end.should raise_error(FrozenError) + end.should.raise(FrozenError) -> do ArraySpecs.frozen_array.send :initialize, ArraySpecs.frozen_array - end.should raise_error(FrozenError) + end.should.raise(FrozenError) end it "calls #to_ary to convert the value to an array, even if it's private" do @@ -49,12 +49,12 @@ end describe "Array#initialize with no arguments" do it "makes the array empty" do - [1, 2, 3].send(:initialize).should be_empty + [1, 2, 3].send(:initialize).should.empty? end it "does not use the given block" do -> { - -> { [1, 2, 3].send(:initialize) { raise } }.should_not raise_error + -> { [1, 2, 3].send(:initialize) { raise } }.should_not.raise }.should complain(/#{__FILE__}:#{__LINE__-1}: warning: given block not used/, verbose: true) end end @@ -66,7 +66,7 @@ describe "Array#initialize with (array)" do end it "does not use the given block" do - ->{ [1, 2, 3].send(:initialize) { raise } }.should_not raise_error + ->{ [1, 2, 3].send(:initialize) { raise } }.should_not.raise end it "calls #to_ary to convert the value to an array" do @@ -83,7 +83,7 @@ describe "Array#initialize with (array)" do end it "raises a TypeError if an Array type argument and a default object" do - -> { [].send(:initialize, [1, 2], 1) }.should raise_error(TypeError) + -> { [].send(:initialize, [1, 2], 1) }.should.raise(TypeError) end end @@ -92,8 +92,8 @@ describe "Array#initialize with (size, object=nil)" do a = [] obj = [3] a.send(:initialize, 2, obj).should == [obj, obj] - a[0].should equal(obj) - a[1].should equal(obj) + a[0].should.equal?(obj) + a[1].should.equal?(obj) b = [] b.send(:initialize, 3, 14).should == [14, 14, 14] @@ -105,12 +105,12 @@ describe "Array#initialize with (size, object=nil)" do end it "raises an ArgumentError if size is negative" do - -> { [].send(:initialize, -1, :a) }.should raise_error(ArgumentError) - -> { [].send(:initialize, -1) }.should raise_error(ArgumentError) + -> { [].send(:initialize, -1, :a) }.should.raise(ArgumentError) + -> { [].send(:initialize, -1) }.should.raise(ArgumentError) end it "raises an ArgumentError if size is too large" do - -> { [].send(:initialize, fixnum_max+1) }.should raise_error(ArgumentError) + -> { [].send(:initialize, fixnum_max+1) }.should.raise(ArgumentError) end it "calls #to_int to convert the size argument to an Integer when object is given" do @@ -128,7 +128,7 @@ describe "Array#initialize 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]) - ->{ [].send(:initialize, obj, :a) }.should raise_error(TypeError) + ->{ [].send(:initialize, obj, :a) }.should.raise(TypeError) end it "yields the index of the element and sets the element to the value of the block" do -- cgit v1.2.3