1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Use FrozenError instead of frozen_error_class

This commit is contained in:
Nobuyoshi Nakada 2020-02-09 11:07:01 +09:00
parent 151f8be40d
commit 3a2073e61b
Notes: git 2020-04-01 15:36:48 +09:00
103 changed files with 367 additions and 385 deletions

View file

@ -114,22 +114,22 @@ describe :array_collect_b, shared: true do
end
describe "when frozen" do
it "raises a #{frozen_error_class}" do
-> { ArraySpecs.frozen_array.send(@method) {} }.should raise_error(frozen_error_class)
it "raises a FrozenError" do
-> { ArraySpecs.frozen_array.send(@method) {} }.should raise_error(FrozenError)
end
it "raises a #{frozen_error_class} when empty" do
-> { ArraySpecs.empty_frozen_array.send(@method) {} }.should raise_error(frozen_error_class)
it "raises a FrozenError when empty" do
-> { ArraySpecs.empty_frozen_array.send(@method) {} }.should raise_error(FrozenError)
end
it "raises a #{frozen_error_class} when calling #each on the returned Enumerator" do
it "raises a FrozenError when calling #each on the returned Enumerator" do
enumerator = ArraySpecs.frozen_array.send(@method)
-> { enumerator.each {|x| x } }.should raise_error(frozen_error_class)
-> { enumerator.each {|x| x } }.should raise_error(FrozenError)
end
it "raises a #{frozen_error_class} when calling #each on the returned Enumerator when empty" do
it "raises a FrozenError when calling #each on the returned Enumerator when empty" do
enumerator = ArraySpecs.empty_frozen_array.send(@method)
-> { enumerator.each {|x| x } }.should raise_error(frozen_error_class)
-> { enumerator.each {|x| x } }.should raise_error(FrozenError)
end
end

View file

@ -41,8 +41,8 @@ describe :keep_if, shared: true do
@frozen.should == @origin
end
it "raises a #{frozen_error_class}" do
-> { @frozen.send(@method) { true } }.should raise_error(frozen_error_class)
it "raises a FrozenError" do
-> { @frozen.send(@method) { true } }.should raise_error(FrozenError)
end
end
@ -52,8 +52,8 @@ describe :keep_if, shared: true do
@frozen.should == @origin
end
it "raises a #{frozen_error_class}" do
-> { @frozen.send(@method) { false } }.should raise_error(frozen_error_class)
it "raises a FrozenError" do
-> { @frozen.send(@method) { false } }.should raise_error(FrozenError)
end
end
end

View file

@ -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 #{frozen_error_class} on a frozen array" do
-> { ArraySpecs.frozen_array.send(@method, 1) }.should raise_error(frozen_error_class)
-> { ArraySpecs.frozen_array.send(@method) }.should raise_error(frozen_error_class)
it "raises a FrozenError on a frozen array" do
-> { ArraySpecs.frozen_array.send(@method, 1) }.should raise_error(FrozenError)
-> { ArraySpecs.frozen_array.send(@method) }.should raise_error(FrozenError)
end
end

View file

@ -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 #{frozen_error_class} on a frozen array" do
it "raises a FrozenError on a frozen array" do
-> {
ArraySpecs.frozen_array.send(@method, ArraySpecs.frozen_array)
}.should raise_error(frozen_error_class)
}.should raise_error(FrozenError)
end
end

View file

@ -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 #{frozen_error_class} on a frozen array when the array is modified" do
-> { ArraySpecs.frozen_array.send(@method, 1) }.should raise_error(frozen_error_class)
it "raises a FrozenError on a frozen array when the array is modified" do
-> { ArraySpecs.frozen_array.send(@method, 1) }.should raise_error(FrozenError)
end
# see [ruby-core:23666]
it "raises a #{frozen_error_class} on a frozen array when the array would not be modified" do
-> { ArraySpecs.frozen_array.send(@method) }.should raise_error(frozen_error_class)
it "raises a FrozenError on a frozen array when the array would not be modified" do
-> { ArraySpecs.frozen_array.send(@method) }.should raise_error(FrozenError)
end
end