aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/array
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-27 16:12:47 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-27 16:12:47 +0000
commita34db218ade33b79e7404488db5a15bad2841c25 (patch)
tree2ed22ad149cd75e36d9aabbe29b32e96c27fa3a6 /spec/ruby/core/array
parent0f989b87a06563add3fdeb9cda983492e8a420af (diff)
downloadruby-a34db218ade33b79e7404488db5a15bad2841c25.tar.gz
Update to ruby/spec@0fe33ac
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/core/array')
-rw-r--r--spec/ruby/core/array/append_spec.rb4
-rw-r--r--spec/ruby/core/array/clear_spec.rb4
-rw-r--r--spec/ruby/core/array/compact_spec.rb4
-rw-r--r--spec/ruby/core/array/concat_spec.rb8
-rw-r--r--spec/ruby/core/array/delete_at_spec.rb4
-rw-r--r--spec/ruby/core/array/delete_if_spec.rb8
-rw-r--r--spec/ruby/core/array/delete_spec.rb4
-rw-r--r--spec/ruby/core/array/element_set_spec.rb8
-rw-r--r--spec/ruby/core/array/fill_spec.rb8
-rw-r--r--spec/ruby/core/array/flatten_spec.rb10
-rw-r--r--spec/ruby/core/array/initialize_spec.rb6
-rw-r--r--spec/ruby/core/array/insert_spec.rb8
-rw-r--r--spec/ruby/core/array/pack/j_spec.rb7
-rw-r--r--spec/ruby/core/array/pop_spec.rb14
-rw-r--r--spec/ruby/core/array/reject_spec.rb8
-rw-r--r--spec/ruby/core/array/reverse_spec.rb4
-rw-r--r--spec/ruby/core/array/rotate_spec.rb8
-rw-r--r--spec/ruby/core/array/shared/collect.rb16
-rw-r--r--spec/ruby/core/array/shared/keep_if.rb8
-rw-r--r--spec/ruby/core/array/shared/push.rb6
-rw-r--r--spec/ruby/core/array/shared/replace.rb4
-rw-r--r--spec/ruby/core/array/shared/unshift.rb8
-rw-r--r--spec/ruby/core/array/shift_spec.rb8
-rw-r--r--spec/ruby/core/array/shuffle_spec.rb6
-rw-r--r--spec/ruby/core/array/slice_spec.rb4
-rw-r--r--spec/ruby/core/array/sort_by_spec.rb8
-rw-r--r--spec/ruby/core/array/sort_spec.rb4
-rw-r--r--spec/ruby/core/array/uniq_spec.rb12
28 files changed, 99 insertions, 102 deletions
diff --git a/spec/ruby/core/array/append_spec.rb b/spec/ruby/core/array/append_spec.rb
index 90e1688c5a..5131e71b3c 100644
--- a/spec/ruby/core/array/append_spec.rb
+++ b/spec/ruby/core/array/append_spec.rb
@@ -30,8 +30,8 @@ describe "Array#<<" do
a.should == [:foo]
end
- it "raises a RuntimeError on a frozen array" do
- lambda { ArraySpecs.frozen_array << 5 }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on a frozen array" do
+ lambda { ArraySpecs.frozen_array << 5 }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/clear_spec.rb b/spec/ruby/core/array/clear_spec.rb
index 851c90d654..0789adaa4e 100644
--- a/spec/ruby/core/array/clear_spec.rb
+++ b/spec/ruby/core/array/clear_spec.rb
@@ -41,9 +41,9 @@ describe "Array#clear" do
a.untrusted?.should be_true
end
- it "raises a RuntimeError on a frozen array" do
+ it "raises a #{frozen_error_class} on a frozen array" do
a = [1]
a.freeze
- lambda { a.clear }.should raise_error(RuntimeError)
+ lambda { a.clear }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/compact_spec.rb b/spec/ruby/core/array/compact_spec.rb
index b80f0214ec..21106d1d6f 100644
--- a/spec/ruby/core/array/compact_spec.rb
+++ b/spec/ruby/core/array/compact_spec.rb
@@ -71,7 +71,7 @@ describe "Array#compact!" do
a.untrusted?.should be_true
end
- it "raises a RuntimeError on a frozen array" do
- lambda { ArraySpecs.frozen_array.compact! }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on a frozen array" do
+ lambda { ArraySpecs.frozen_array.compact! }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/concat_spec.rb b/spec/ruby/core/array/concat_spec.rb
index 86ec557bde..a92cf3c8db 100644
--- a/spec/ruby/core/array/concat_spec.rb
+++ b/spec/ruby/core/array/concat_spec.rb
@@ -32,13 +32,13 @@ describe "Array#concat" do
[].concat(obj).should == [5, 6, 7]
end
- it "raises a RuntimeError when Array is frozen and modification occurs" do
- lambda { ArraySpecs.frozen_array.concat [1] }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} when Array is frozen and modification occurs" do
+ lambda { ArraySpecs.frozen_array.concat [1] }.should raise_error(frozen_error_class)
end
# see [ruby-core:23666]
- it "raises a RuntimeError when Array is frozen and no modification occurs" do
- lambda { ArraySpecs.frozen_array.concat([]) }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} when Array is frozen and no modification occurs" do
+ lambda { ArraySpecs.frozen_array.concat([]) }.should raise_error(frozen_error_class)
end
it "keeps tainted status" do
diff --git a/spec/ruby/core/array/delete_at_spec.rb b/spec/ruby/core/array/delete_at_spec.rb
index 1d73ceb33a..4c2deb13a1 100644
--- a/spec/ruby/core/array/delete_at_spec.rb
+++ b/spec/ruby/core/array/delete_at_spec.rb
@@ -35,8 +35,8 @@ describe "Array#delete_at" do
a.delete_at(-2).should == 1
end
- it "raises a RuntimeError on a frozen array" do
- lambda { [1,2,3].freeze.delete_at(0) }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on a frozen array" do
+ lambda { [1,2,3].freeze.delete_at(0) }.should raise_error(frozen_error_class)
end
it "keeps tainted status" do
diff --git a/spec/ruby/core/array/delete_if_spec.rb b/spec/ruby/core/array/delete_if_spec.rb
index 4276a1fb65..e8d79270b4 100644
--- a/spec/ruby/core/array/delete_if_spec.rb
+++ b/spec/ruby/core/array/delete_if_spec.rb
@@ -39,12 +39,12 @@ describe "Array#delete_if" do
@a.freeze.delete_if.should be_an_instance_of(Enumerator)
end
- it "raises a RuntimeError on a frozen array" do
- lambda { ArraySpecs.frozen_array.delete_if {} }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on a frozen array" do
+ lambda { ArraySpecs.frozen_array.delete_if {} }.should raise_error(frozen_error_class)
end
- it "raises a RuntimeError on an empty frozen array" do
- lambda { ArraySpecs.empty_frozen_array.delete_if {} }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on an empty frozen array" do
+ lambda { ArraySpecs.empty_frozen_array.delete_if {} }.should raise_error(frozen_error_class)
end
it "keeps tainted status" do
diff --git a/spec/ruby/core/array/delete_spec.rb b/spec/ruby/core/array/delete_spec.rb
index 7b6bf3930c..cbd30d6f07 100644
--- a/spec/ruby/core/array/delete_spec.rb
+++ b/spec/ruby/core/array/delete_spec.rb
@@ -40,8 +40,8 @@ describe "Array#delete" do
[1, 2, 3].freeze.delete(0).should == nil
end
- it "raises a RuntimeError on a frozen array" do
- lambda { [1, 2, 3].freeze.delete(1) }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on a frozen array" do
+ lambda { [1, 2, 3].freeze.delete(1) }.should raise_error(frozen_error_class)
end
it "keeps tainted status" do
diff --git a/spec/ruby/core/array/element_set_spec.rb b/spec/ruby/core/array/element_set_spec.rb
index 6544ad9b6f..9c6a1d05a8 100644
--- a/spec/ruby/core/array/element_set_spec.rb
+++ b/spec/ruby/core/array/element_set_spec.rb
@@ -94,8 +94,8 @@ describe "Array#[]=" do
it "checks frozen before attempting to coerce arguments" do
a = [1,2,3,4].freeze
- lambda {a[:foo] = 1}.should raise_error(RuntimeError)
- lambda {a[:foo, :bar] = 1}.should raise_error(RuntimeError)
+ lambda {a[:foo] = 1}.should raise_error(frozen_error_class)
+ lambda {a[:foo, :bar] = 1}.should raise_error(frozen_error_class)
end
it "sets elements in the range arguments when passed ranges" do
@@ -236,8 +236,8 @@ describe "Array#[]=" do
ary.should == [5, 6, 7]
end
- it "raises a RuntimeError on a frozen array" do
- lambda { ArraySpecs.frozen_array[0, 0] = [] }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on a frozen array" do
+ lambda { ArraySpecs.frozen_array[0, 0] = [] }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/fill_spec.rb b/spec/ruby/core/array/fill_spec.rb
index 5ff7f8a250..1c44d54421 100644
--- a/spec/ruby/core/array/fill_spec.rb
+++ b/spec/ruby/core/array/fill_spec.rb
@@ -43,12 +43,12 @@ describe "Array#fill" do
[nil, nil, nil, nil].fill { |i| i * 2 }.should == [0, 2, 4, 6]
end
- it "raises a RuntimeError on a frozen array" do
- lambda { ArraySpecs.frozen_array.fill('x') }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on a frozen array" do
+ lambda { ArraySpecs.frozen_array.fill('x') }.should raise_error(frozen_error_class)
end
- it "raises a RuntimeError on an empty frozen array" do
- lambda { ArraySpecs.empty_frozen_array.fill('x') }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on an empty frozen array" do
+ lambda { ArraySpecs.empty_frozen_array.fill('x') }.should raise_error(frozen_error_class)
end
it "raises an ArgumentError if 4 or more arguments are passed when no block given" do
diff --git a/spec/ruby/core/array/flatten_spec.rb b/spec/ruby/core/array/flatten_spec.rb
index 3b20e976b6..3c8502c827 100644
--- a/spec/ruby/core/array/flatten_spec.rb
+++ b/spec/ruby/core/array/flatten_spec.rb
@@ -272,15 +272,15 @@ describe "Array#flatten!" do
ary.should == [1, 2, 3]
end
- it "raises a RuntimeError on frozen arrays when the array is modified" do
+ it "raises a #{frozen_error_class} on frozen arrays when the array is modified" do
nested_ary = [1, 2, []]
nested_ary.freeze
- lambda { nested_ary.flatten! }.should raise_error(RuntimeError)
+ lambda { nested_ary.flatten! }.should raise_error(frozen_error_class)
end
# see [ruby-core:23663]
- it "raises a RuntimeError on frozen arrays when the array would not be modified" do
- lambda { ArraySpecs.frozen_array.flatten! }.should raise_error(RuntimeError)
- lambda { ArraySpecs.empty_frozen_array.flatten! }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on frozen arrays when the array would not be modified" do
+ lambda { ArraySpecs.frozen_array.flatten! }.should raise_error(frozen_error_class)
+ lambda { ArraySpecs.empty_frozen_array.flatten! }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/initialize_spec.rb b/spec/ruby/core/array/initialize_spec.rb
index 0c37c6136d..b51b76acd3 100644
--- a/spec/ruby/core/array/initialize_spec.rb
+++ b/spec/ruby/core/array/initialize_spec.rb
@@ -32,13 +32,13 @@ describe "Array#initialize" do
end.should raise_error(ArgumentError)
end
- it "raises a RuntimeError on frozen arrays" do
+ it "raises a #{frozen_error_class} on frozen arrays" do
lambda do
ArraySpecs.frozen_array.send :initialize
- end.should raise_error(RuntimeError)
+ end.should raise_error(frozen_error_class)
lambda do
ArraySpecs.frozen_array.send :initialize, ArraySpecs.frozen_array
- end.should raise_error(RuntimeError)
+ end.should raise_error(frozen_error_class)
end
it "calls #to_ary to convert the value to an array, even if it's private" do
diff --git a/spec/ruby/core/array/insert_spec.rb b/spec/ruby/core/array/insert_spec.rb
index cdf870df2a..c7acdac275 100644
--- a/spec/ruby/core/array/insert_spec.rb
+++ b/spec/ruby/core/array/insert_spec.rb
@@ -67,12 +67,12 @@ describe "Array#insert" do
lambda { [].insert() }.should raise_error(ArgumentError)
end
- it "raises a RuntimeError on frozen arrays when the array is modified" do
- lambda { ArraySpecs.frozen_array.insert(0, 'x') }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on frozen arrays when the array is modified" do
+ lambda { ArraySpecs.frozen_array.insert(0, 'x') }.should raise_error(frozen_error_class)
end
# see [ruby-core:23666]
- it "raises a RuntimeError on frozen arrays when the array would not be modified" do
- lambda { ArraySpecs.frozen_array.insert(0) }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on frozen arrays when the array would not be modified" do
+ lambda { ArraySpecs.frozen_array.insert(0) }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/pack/j_spec.rb b/spec/ruby/core/array/pack/j_spec.rb
index 88f074724c..1fe81db61f 100644
--- a/spec/ruby/core/array/pack/j_spec.rb
+++ b/spec/ruby/core/array/pack/j_spec.rb
@@ -5,10 +5,7 @@ require File.expand_path('../shared/numeric_basic', __FILE__)
require File.expand_path('../shared/integer', __FILE__)
ruby_version_is '2.3' do
- # To handle the special case of x64-mingw32
- pointer_size = RUBY_PLATFORM =~ /\bx64\b/ ? 64 : 1.size * 8
-
- guard -> { pointer_size == 64 } do
+ platform_is pointer_size: 64 do
describe "Array#pack with format 'J'" do
it_behaves_like :array_pack_basic, 'J'
it_behaves_like :array_pack_basic_non_float, 'J'
@@ -114,7 +111,7 @@ ruby_version_is '2.3' do
end
end
- guard -> { pointer_size == 32 } do
+ platform_is pointer_size: 32 do
describe "Array#pack with format 'J'" do
it_behaves_like :array_pack_basic, 'J'
it_behaves_like :array_pack_basic_non_float, 'J'
diff --git a/spec/ruby/core/array/pop_spec.rb b/spec/ruby/core/array/pop_spec.rb
index ea649c6585..aa3eb031a2 100644
--- a/spec/ruby/core/array/pop_spec.rb
+++ b/spec/ruby/core/array/pop_spec.rb
@@ -38,12 +38,12 @@ describe "Array#pop" do
a.tainted?.should be_true
end
- it "raises a RuntimeError on a frozen array" do
- lambda { ArraySpecs.frozen_array.pop }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on a frozen array" do
+ lambda { ArraySpecs.frozen_array.pop }.should raise_error(frozen_error_class)
end
- it "raises a RuntimeError on an empty frozen array" do
- lambda { ArraySpecs.empty_frozen_array.pop }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on an empty frozen array" do
+ lambda { ArraySpecs.empty_frozen_array.pop }.should raise_error(frozen_error_class)
end
it "keeps untrusted status" do
@@ -152,9 +152,9 @@ describe "Array#pop" do
ary.pop(0).untrusted?.should be_false
end
- it "raises a RuntimeError on a frozen array" do
- lambda { ArraySpecs.frozen_array.pop(2) }.should raise_error(RuntimeError)
- lambda { ArraySpecs.frozen_array.pop(0) }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on a frozen array" do
+ lambda { ArraySpecs.frozen_array.pop(2) }.should raise_error(frozen_error_class)
+ lambda { ArraySpecs.frozen_array.pop(0) }.should raise_error(frozen_error_class)
end
it "keeps untrusted status" do
diff --git a/spec/ruby/core/array/reject_spec.rb b/spec/ruby/core/array/reject_spec.rb
index 857cbf6a4d..2dba6f58e7 100644
--- a/spec/ruby/core/array/reject_spec.rb
+++ b/spec/ruby/core/array/reject_spec.rb
@@ -103,12 +103,12 @@ describe "Array#reject!" do
ArraySpecs.frozen_array.reject!.should be_an_instance_of(Enumerator)
end
- it "raises a RuntimeError on a frozen array" do
- lambda { ArraySpecs.frozen_array.reject! {} }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on a frozen array" do
+ lambda { ArraySpecs.frozen_array.reject! {} }.should raise_error(frozen_error_class)
end
- it "raises a RuntimeError on an empty frozen array" do
- lambda { ArraySpecs.empty_frozen_array.reject! {} }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on an empty frozen array" do
+ lambda { ArraySpecs.empty_frozen_array.reject! {} }.should raise_error(frozen_error_class)
end
it_behaves_like :enumeratorize, :reject!
diff --git a/spec/ruby/core/array/reverse_spec.rb b/spec/ruby/core/array/reverse_spec.rb
index a3a6db9506..061d9540ba 100644
--- a/spec/ruby/core/array/reverse_spec.rb
+++ b/spec/ruby/core/array/reverse_spec.rb
@@ -36,7 +36,7 @@ describe "Array#reverse!" do
array.reverse!.should == [array, array, array, array, array, 3.0, 'two', 1]
end
- it "raises a RuntimeError on a frozen array" do
- lambda { ArraySpecs.frozen_array.reverse! }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on a frozen array" do
+ lambda { ArraySpecs.frozen_array.reverse! }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/rotate_spec.rb b/spec/ruby/core/array/rotate_spec.rb
index 270bfeb446..56c1f7e0ee 100644
--- a/spec/ruby/core/array/rotate_spec.rb
+++ b/spec/ruby/core/array/rotate_spec.rb
@@ -121,9 +121,9 @@ describe "Array#rotate!" do
a.should == []
end
- it "raises a RuntimeError on a frozen array" do
- lambda { [1, 2, 3].freeze.rotate!(0) }.should raise_error(RuntimeError)
- lambda { [1].freeze.rotate!(42) }.should raise_error(RuntimeError)
- lambda { [].freeze.rotate! }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on a frozen array" do
+ lambda { [1, 2, 3].freeze.rotate!(0) }.should raise_error(frozen_error_class)
+ lambda { [1].freeze.rotate!(42) }.should raise_error(frozen_error_class)
+ lambda { [].freeze.rotate! }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/shared/collect.rb b/spec/ruby/core/array/shared/collect.rb
index f6bcfd8904..2c75675b9d 100644
--- a/spec/ruby/core/array/shared/collect.rb
+++ b/spec/ruby/core/array/shared/collect.rb
@@ -110,22 +110,22 @@ describe :array_collect_b, shared: true do
end
describe "when frozen" do
- it "raises a RuntimeError" do
- lambda { ArraySpecs.frozen_array.send(@method) {} }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class}" do
+ lambda { ArraySpecs.frozen_array.send(@method) {} }.should raise_error(frozen_error_class)
end
- it "raises a RuntimeError when empty" do
- lambda { ArraySpecs.empty_frozen_array.send(@method) {} }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} when empty" do
+ lambda { ArraySpecs.empty_frozen_array.send(@method) {} }.should raise_error(frozen_error_class)
end
- it "raises a RuntimeError when calling #each on the returned Enumerator" do
+ it "raises a #{frozen_error_class} when calling #each on the returned Enumerator" do
enumerator = ArraySpecs.frozen_array.send(@method)
- lambda { enumerator.each {|x| x } }.should raise_error(RuntimeError)
+ lambda { enumerator.each {|x| x } }.should raise_error(frozen_error_class)
end
- it "raises a RuntimeError when calling #each on the returned Enumerator when empty" do
+ it "raises a #{frozen_error_class} when calling #each on the returned Enumerator when empty" do
enumerator = ArraySpecs.empty_frozen_array.send(@method)
- lambda { enumerator.each {|x| x } }.should raise_error(RuntimeError)
+ lambda { enumerator.each {|x| x } }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/shared/keep_if.rb b/spec/ruby/core/array/shared/keep_if.rb
index 581ba31d1b..0f65d060d8 100644
--- a/spec/ruby/core/array/shared/keep_if.rb
+++ b/spec/ruby/core/array/shared/keep_if.rb
@@ -41,8 +41,8 @@ describe :keep_if, shared: true do
@frozen.should == @origin
end
- it "raises a RuntimeError" do
- lambda { @frozen.send(@method) { true } }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class}" do
+ lambda { @frozen.send(@method) { true } }.should raise_error(frozen_error_class)
end
end
@@ -52,8 +52,8 @@ describe :keep_if, shared: true do
@frozen.should == @origin
end
- it "raises a RuntimeError" do
- lambda { @frozen.send(@method) { false } }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class}" do
+ lambda { @frozen.send(@method) { false } }.should raise_error(frozen_error_class)
end
end
end
diff --git a/spec/ruby/core/array/shared/push.rb b/spec/ruby/core/array/shared/push.rb
index 5951b71a19..effa632890 100644
--- a/spec/ruby/core/array/shared/push.rb
+++ b/spec/ruby/core/array/shared/push.rb
@@ -26,8 +26,8 @@ describe :array_push, shared: true do
array.send(@method, :last).should == [1, 'two', 3.0, array, array, array, array, array, :last]
end
- it "raises a RuntimeError on a frozen array" do
- lambda { ArraySpecs.frozen_array.send(@method, 1) }.should raise_error(RuntimeError)
- lambda { ArraySpecs.frozen_array.send(@method) }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on a frozen array" do
+ lambda { ArraySpecs.frozen_array.send(@method, 1) }.should raise_error(frozen_error_class)
+ lambda { ArraySpecs.frozen_array.send(@method) }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/shared/replace.rb b/spec/ruby/core/array/shared/replace.rb
index 8442d9a841..b8dae8d33e 100644
--- a/spec/ruby/core/array/shared/replace.rb
+++ b/spec/ruby/core/array/shared/replace.rb
@@ -52,9 +52,9 @@ describe :array_replace, shared: true do
[].send(@method, ArraySpecs::ToAryArray[5, 6, 7]).should == [5, 6, 7]
end
- it "raises a RuntimeError on a frozen array" do
+ it "raises a #{frozen_error_class} on a frozen array" do
lambda {
ArraySpecs.frozen_array.send(@method, ArraySpecs.frozen_array)
- }.should raise_error(RuntimeError)
+ }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/shared/unshift.rb b/spec/ruby/core/array/shared/unshift.rb
index 367bab4166..d7464cdaca 100644
--- a/spec/ruby/core/array/shared/unshift.rb
+++ b/spec/ruby/core/array/shared/unshift.rb
@@ -35,12 +35,12 @@ describe :array_unshift, shared: true do
array[0..5].should == [:new, 1, 'two', 3.0, array, array]
end
- it "raises a RuntimeError on a frozen array when the array is modified" do
- lambda { ArraySpecs.frozen_array.send(@method, 1) }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on a frozen array when the array is modified" do
+ lambda { ArraySpecs.frozen_array.send(@method, 1) }.should raise_error(frozen_error_class)
end
# see [ruby-core:23666]
- it "raises a RuntimeError on a frozen array when the array would not be modified" do
- lambda { ArraySpecs.frozen_array.send(@method) }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on a frozen array when the array would not be modified" do
+ lambda { ArraySpecs.frozen_array.send(@method) }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/shift_spec.rb b/spec/ruby/core/array/shift_spec.rb
index a7b6f58392..45a9c44ad7 100644
--- a/spec/ruby/core/array/shift_spec.rb
+++ b/spec/ruby/core/array/shift_spec.rb
@@ -30,11 +30,11 @@ describe "Array#shift" do
array[0..2].should == ['two', 3.0, array]
end
- it "raises a RuntimeError on a frozen array" do
- lambda { ArraySpecs.frozen_array.shift }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on a frozen array" do
+ lambda { ArraySpecs.frozen_array.shift }.should raise_error(frozen_error_class)
end
- it "raises a RuntimeError on an empty frozen array" do
- lambda { ArraySpecs.empty_frozen_array.shift }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on an empty frozen array" do
+ lambda { ArraySpecs.empty_frozen_array.shift }.should raise_error(frozen_error_class)
end
describe "passed a number n as an argument" do
diff --git a/spec/ruby/core/array/shuffle_spec.rb b/spec/ruby/core/array/shuffle_spec.rb
index 4c3b820186..bd6f379893 100644
--- a/spec/ruby/core/array/shuffle_spec.rb
+++ b/spec/ruby/core/array/shuffle_spec.rb
@@ -95,8 +95,8 @@ describe "Array#shuffle!" do
a.should equal(original)
end
- it "raises a RuntimeError on a frozen array" do
- lambda { ArraySpecs.frozen_array.shuffle! }.should raise_error(RuntimeError)
- lambda { ArraySpecs.empty_frozen_array.shuffle! }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on a frozen array" do
+ lambda { ArraySpecs.frozen_array.shuffle! }.should raise_error(frozen_error_class)
+ lambda { ArraySpecs.empty_frozen_array.shuffle! }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/slice_spec.rb b/spec/ruby/core/array/slice_spec.rb
index f6cbd1bcc4..31d2983aef 100644
--- a/spec/ruby/core/array/slice_spec.rb
+++ b/spec/ruby/core/array/slice_spec.rb
@@ -150,8 +150,8 @@ describe "Array#slice!" do
a.should == [1, 2]
end
- it "raises a RuntimeError on a frozen array" do
- lambda { ArraySpecs.frozen_array.slice!(0, 0) }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on a frozen array" do
+ lambda { ArraySpecs.frozen_array.slice!(0, 0) }.should raise_error(frozen_error_class)
end
end
diff --git a/spec/ruby/core/array/sort_by_spec.rb b/spec/ruby/core/array/sort_by_spec.rb
index 9f45f3ef4d..16fabce69f 100644
--- a/spec/ruby/core/array/sort_by_spec.rb
+++ b/spec/ruby/core/array/sort_by_spec.rb
@@ -23,12 +23,12 @@ describe "Array#sort_by!" do
a.should be_an_instance_of(Array)
end
- it "raises a RuntimeError on a frozen array" do
- lambda { ArraySpecs.frozen_array.sort_by! {}}.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on a frozen array" do
+ lambda { ArraySpecs.frozen_array.sort_by! {}}.should raise_error(frozen_error_class)
end
- it "raises a RuntimeError on an empty frozen array" do
- lambda { ArraySpecs.empty_frozen_array.sort_by! {}}.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on an empty frozen array" do
+ lambda { ArraySpecs.empty_frozen_array.sort_by! {}}.should raise_error(frozen_error_class)
end
it "returns the specified value when it would break in the given block" do
diff --git a/spec/ruby/core/array/sort_spec.rb b/spec/ruby/core/array/sort_spec.rb
index 0578742175..070b4e84a3 100644
--- a/spec/ruby/core/array/sort_spec.rb
+++ b/spec/ruby/core/array/sort_spec.rb
@@ -233,8 +233,8 @@ describe "Array#sort!" do
a.sort!{ -1 }.should be_an_instance_of(Array)
end
- it "raises a RuntimeError on a frozen array" do
- lambda { ArraySpecs.frozen_array.sort! }.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on a frozen array" do
+ lambda { ArraySpecs.frozen_array.sort! }.should raise_error(frozen_error_class)
end
it "returns the specified value when it would break in the given block" do
diff --git a/spec/ruby/core/array/uniq_spec.rb b/spec/ruby/core/array/uniq_spec.rb
index 199b084376..001ca73731 100644
--- a/spec/ruby/core/array/uniq_spec.rb
+++ b/spec/ruby/core/array/uniq_spec.rb
@@ -188,20 +188,20 @@ describe "Array#uniq!" do
[ "a", "b", "c" ].uniq!.should == nil
end
- it "raises a RuntimeError on a frozen array when the array is modified" do
+ it "raises a #{frozen_error_class} on a frozen array when the array is modified" do
dup_ary = [1, 1, 2]
dup_ary.freeze
- lambda { dup_ary.uniq! }.should raise_error(RuntimeError)
+ lambda { dup_ary.uniq! }.should raise_error(frozen_error_class)
end
# see [ruby-core:23666]
- it "raises a RuntimeError on a frozen array when the array would not be modified" do
- lambda { ArraySpecs.frozen_array.uniq!}.should raise_error(RuntimeError)
- lambda { ArraySpecs.empty_frozen_array.uniq!}.should raise_error(RuntimeError)
+ it "raises a #{frozen_error_class} on a frozen array when the array would not be modified" do
+ lambda { ArraySpecs.frozen_array.uniq!}.should raise_error(frozen_error_class)
+ lambda { ArraySpecs.empty_frozen_array.uniq!}.should raise_error(frozen_error_class)
end
it "doesn't yield to the block on a frozen array" do
- lambda { ArraySpecs.frozen_array.uniq!{ raise RangeError, "shouldn't yield"}}.should raise_error(RuntimeError)
+ lambda { ArraySpecs.frozen_array.uniq!{ raise RangeError, "shouldn't yield"}}.should raise_error(frozen_error_class)
end
it "compares elements based on the value returned from the block" do