diff options
Diffstat (limited to 'spec/ruby/core/hash')
-rw-r--r-- | spec/ruby/core/hash/clear_spec.rb | 6 | ||||
-rw-r--r-- | spec/ruby/core/hash/compact_spec.rb | 4 | ||||
-rw-r--r-- | spec/ruby/core/hash/compare_by_identity_spec.rb | 4 | ||||
-rw-r--r-- | spec/ruby/core/hash/default_proc_spec.rb | 6 | ||||
-rw-r--r-- | spec/ruby/core/hash/default_spec.rb | 6 | ||||
-rw-r--r-- | spec/ruby/core/hash/delete_if_spec.rb | 6 | ||||
-rw-r--r-- | spec/ruby/core/hash/delete_spec.rb | 6 | ||||
-rw-r--r-- | spec/ruby/core/hash/initialize_spec.rb | 10 | ||||
-rw-r--r-- | spec/ruby/core/hash/keep_if_spec.rb | 6 | ||||
-rw-r--r-- | spec/ruby/core/hash/rehash_spec.rb | 6 | ||||
-rw-r--r-- | spec/ruby/core/hash/reject_spec.rb | 8 | ||||
-rw-r--r-- | spec/ruby/core/hash/select_spec.rb | 8 | ||||
-rw-r--r-- | spec/ruby/core/hash/shared/replace.rb | 8 | ||||
-rw-r--r-- | spec/ruby/core/hash/shared/store.rb | 4 | ||||
-rw-r--r-- | spec/ruby/core/hash/shared/update.rb | 10 | ||||
-rw-r--r-- | spec/ruby/core/hash/shift_spec.rb | 6 | ||||
-rw-r--r-- | spec/ruby/core/hash/transform_keys_spec.rb | 8 | ||||
-rw-r--r-- | spec/ruby/core/hash/transform_values_spec.rb | 8 |
18 files changed, 60 insertions, 60 deletions
diff --git a/spec/ruby/core/hash/clear_spec.rb b/spec/ruby/core/hash/clear_spec.rb index ea8235451a..1d57dfbcc6 100644 --- a/spec/ruby/core/hash/clear_spec.rb +++ b/spec/ruby/core/hash/clear_spec.rb @@ -25,8 +25,8 @@ describe "Hash#clear" do h.default_proc.should_not == nil end - it "raises a RuntimeError if called on a frozen instance" do - lambda { HashSpecs.frozen_hash.clear }.should raise_error(RuntimeError) - lambda { HashSpecs.empty_frozen_hash.clear }.should raise_error(RuntimeError) + it "raises a #{frozen_error_class} if called on a frozen instance" do + lambda { HashSpecs.frozen_hash.clear }.should raise_error(frozen_error_class) + lambda { HashSpecs.empty_frozen_hash.clear }.should raise_error(frozen_error_class) end end diff --git a/spec/ruby/core/hash/compact_spec.rb b/spec/ruby/core/hash/compact_spec.rb index d9ef8a2987..15c2e651c4 100644 --- a/spec/ruby/core/hash/compact_spec.rb +++ b/spec/ruby/core/hash/compact_spec.rb @@ -52,8 +52,8 @@ ruby_version_is "2.4" do @hash.freeze end - it "keeps pairs and raises a RuntimeError" do - ->{ @hash.compact! }.should raise_error(RuntimeError) + it "keeps pairs and raises a #{frozen_error_class}" do + ->{ @hash.compact! }.should raise_error(frozen_error_class) @hash.should == @initial_pairs end end diff --git a/spec/ruby/core/hash/compare_by_identity_spec.rb b/spec/ruby/core/hash/compare_by_identity_spec.rb index a518e0cdb3..34541037b9 100644 --- a/spec/ruby/core/hash/compare_by_identity_spec.rb +++ b/spec/ruby/core/hash/compare_by_identity_spec.rb @@ -80,9 +80,9 @@ describe "Hash#compare_by_identity" do @h[o].should == :o end - it "raises a RuntimeError on frozen hashes" do + it "raises a #{frozen_error_class} on frozen hashes" do @h = @h.freeze - lambda { @h.compare_by_identity }.should raise_error(RuntimeError) + lambda { @h.compare_by_identity }.should raise_error(frozen_error_class) end # Behaviour confirmed in bug #1871 diff --git a/spec/ruby/core/hash/default_proc_spec.rb b/spec/ruby/core/hash/default_proc_spec.rb index 0bd20d43af..64287cbc7c 100644 --- a/spec/ruby/core/hash/default_proc_spec.rb +++ b/spec/ruby/core/hash/default_proc_spec.rb @@ -73,8 +73,8 @@ describe "Hash#default_proc=" do end.should raise_error(TypeError) end - it "raises a RuntimeError if self is frozen" do - lambda { {}.freeze.default_proc = Proc.new {} }.should raise_error(RuntimeError) - lambda { {}.freeze.default_proc = nil }.should raise_error(RuntimeError) + it "raises a #{frozen_error_class} if self is frozen" do + lambda { {}.freeze.default_proc = Proc.new {} }.should raise_error(frozen_error_class) + lambda { {}.freeze.default_proc = nil }.should raise_error(frozen_error_class) end end diff --git a/spec/ruby/core/hash/default_spec.rb b/spec/ruby/core/hash/default_spec.rb index 6c1c7377b7..45e0b9d1fe 100644 --- a/spec/ruby/core/hash/default_spec.rb +++ b/spec/ruby/core/hash/default_spec.rb @@ -39,8 +39,8 @@ describe "Hash#default=" do end end - it "raises a RuntimeError if called on a frozen instance" do - lambda { HashSpecs.frozen_hash.default = nil }.should raise_error(RuntimeError) - lambda { HashSpecs.empty_frozen_hash.default = nil }.should raise_error(RuntimeError) + it "raises a #{frozen_error_class} if called on a frozen instance" do + lambda { HashSpecs.frozen_hash.default = nil }.should raise_error(frozen_error_class) + lambda { HashSpecs.empty_frozen_hash.default = nil }.should raise_error(frozen_error_class) end end diff --git a/spec/ruby/core/hash/delete_if_spec.rb b/spec/ruby/core/hash/delete_if_spec.rb index d739e4fbab..2edc88a205 100644 --- a/spec/ruby/core/hash/delete_if_spec.rb +++ b/spec/ruby/core/hash/delete_if_spec.rb @@ -34,9 +34,9 @@ describe "Hash#delete_if" do each_pairs.should == delete_pairs end - it "raises a RuntimeError if called on a frozen instance" do - lambda { HashSpecs.frozen_hash.delete_if { false } }.should raise_error(RuntimeError) - lambda { HashSpecs.empty_frozen_hash.delete_if { true } }.should raise_error(RuntimeError) + it "raises a #{frozen_error_class} if called on a frozen instance" do + lambda { HashSpecs.frozen_hash.delete_if { false } }.should raise_error(frozen_error_class) + lambda { HashSpecs.empty_frozen_hash.delete_if { true } }.should raise_error(frozen_error_class) end it_behaves_like(:hash_iteration_no_block, :delete_if) diff --git a/spec/ruby/core/hash/delete_spec.rb b/spec/ruby/core/hash/delete_spec.rb index a41fad3586..e673e12f67 100644 --- a/spec/ruby/core/hash/delete_spec.rb +++ b/spec/ruby/core/hash/delete_spec.rb @@ -37,8 +37,8 @@ describe "Hash#delete" do { key => 5 }.delete(key).should == 5 end - it "raises a RuntimeError if called on a frozen instance" do - lambda { HashSpecs.frozen_hash.delete("foo") }.should raise_error(RuntimeError) - lambda { HashSpecs.empty_frozen_hash.delete("foo") }.should raise_error(RuntimeError) + it "raises a #{frozen_error_class} if called on a frozen instance" do + lambda { HashSpecs.frozen_hash.delete("foo") }.should raise_error(frozen_error_class) + lambda { HashSpecs.empty_frozen_hash.delete("foo") }.should raise_error(frozen_error_class) end end diff --git a/spec/ruby/core/hash/initialize_spec.rb b/spec/ruby/core/hash/initialize_spec.rb index aa943d333d..cafe2f0af9 100644 --- a/spec/ruby/core/hash/initialize_spec.rb +++ b/spec/ruby/core/hash/initialize_spec.rb @@ -24,17 +24,17 @@ describe "Hash#initialize" do h.send(:initialize).should equal(h) end - it "raises a RuntimeError if called on a frozen instance" do + it "raises a #{frozen_error_class} if called on a frozen instance" do block = lambda { HashSpecs.frozen_hash.instance_eval { initialize() }} - block.should raise_error(RuntimeError) + block.should raise_error(frozen_error_class) block = lambda { HashSpecs.frozen_hash.instance_eval { initialize(nil) } } - block.should raise_error(RuntimeError) + block.should raise_error(frozen_error_class) block = lambda { HashSpecs.frozen_hash.instance_eval { initialize(5) } } - block.should raise_error(RuntimeError) + block.should raise_error(frozen_error_class) block = lambda { HashSpecs.frozen_hash.instance_eval { initialize { 5 } } } - block.should raise_error(RuntimeError) + block.should raise_error(frozen_error_class) end end diff --git a/spec/ruby/core/hash/keep_if_spec.rb b/spec/ruby/core/hash/keep_if_spec.rb index 6b3a1925d3..7a9db092e2 100644 --- a/spec/ruby/core/hash/keep_if_spec.rb +++ b/spec/ruby/core/hash/keep_if_spec.rb @@ -27,9 +27,9 @@ describe "Hash#keep_if" do h.keep_if { true }.should equal(h) end - it "raises a RuntimeError if called on a frozen instance" do - lambda { HashSpecs.frozen_hash.keep_if { true } }.should raise_error(RuntimeError) - lambda { HashSpecs.empty_frozen_hash.keep_if { false } }.should raise_error(RuntimeError) + it "raises a #{frozen_error_class} if called on a frozen instance" do + lambda { HashSpecs.frozen_hash.keep_if { true } }.should raise_error(frozen_error_class) + lambda { HashSpecs.empty_frozen_hash.keep_if { false } }.should raise_error(frozen_error_class) end it_behaves_like(:hash_iteration_no_block, :keep_if) diff --git a/spec/ruby/core/hash/rehash_spec.rb b/spec/ruby/core/hash/rehash_spec.rb index 09315737b6..5b15af923a 100644 --- a/spec/ruby/core/hash/rehash_spec.rb +++ b/spec/ruby/core/hash/rehash_spec.rb @@ -35,8 +35,8 @@ describe "Hash#rehash" do h[k2].should == v2 end - it "raises a RuntimeError if called on a frozen instance" do - lambda { HashSpecs.frozen_hash.rehash }.should raise_error(RuntimeError) - lambda { HashSpecs.empty_frozen_hash.rehash }.should raise_error(RuntimeError) + it "raises a #{frozen_error_class} if called on a frozen instance" do + lambda { HashSpecs.frozen_hash.rehash }.should raise_error(frozen_error_class) + lambda { HashSpecs.empty_frozen_hash.rehash }.should raise_error(frozen_error_class) end end diff --git a/spec/ruby/core/hash/reject_spec.rb b/spec/ruby/core/hash/reject_spec.rb index 21dd7425aa..557435a019 100644 --- a/spec/ruby/core/hash/reject_spec.rb +++ b/spec/ruby/core/hash/reject_spec.rb @@ -87,12 +87,12 @@ describe "Hash#reject!" do reject_bang_pairs.should == delete_if_pairs end - it "raises a RuntimeError if called on a frozen instance that is modified" do - lambda { HashSpecs.empty_frozen_hash.reject! { true } }.should raise_error(RuntimeError) + it "raises a #{frozen_error_class} if called on a frozen instance that is modified" do + lambda { HashSpecs.empty_frozen_hash.reject! { true } }.should raise_error(frozen_error_class) end - it "raises a RuntimeError if called on a frozen instance that would not be modified" do - lambda { HashSpecs.frozen_hash.reject! { false } }.should raise_error(RuntimeError) + it "raises a #{frozen_error_class} if called on a frozen instance that would not be modified" do + lambda { HashSpecs.frozen_hash.reject! { false } }.should raise_error(frozen_error_class) end it_behaves_like(:hash_iteration_no_block, :reject!) diff --git a/spec/ruby/core/hash/select_spec.rb b/spec/ruby/core/hash/select_spec.rb index 449607b606..8a73116bc1 100644 --- a/spec/ruby/core/hash/select_spec.rb +++ b/spec/ruby/core/hash/select_spec.rb @@ -70,12 +70,12 @@ describe "Hash#select!" do { a: 1 }.select! { |k,v| v <= 1 }.should == nil end - it "raises a RuntimeError if called on an empty frozen instance" do - lambda { HashSpecs.empty_frozen_hash.select! { false } }.should raise_error(RuntimeError) + it "raises a #{frozen_error_class} if called on an empty frozen instance" do + lambda { HashSpecs.empty_frozen_hash.select! { false } }.should raise_error(frozen_error_class) end - it "raises a RuntimeError if called on a frozen instance that would not be modified" do - lambda { HashSpecs.frozen_hash.select! { true } }.should raise_error(RuntimeError) + it "raises a #{frozen_error_class} if called on a frozen instance that would not be modified" do + lambda { HashSpecs.frozen_hash.select! { true } }.should raise_error(frozen_error_class) end it_behaves_like(:hash_iteration_no_block, :select!) diff --git a/spec/ruby/core/hash/shared/replace.rb b/spec/ruby/core/hash/shared/replace.rb index 463c861395..eb51130781 100644 --- a/spec/ruby/core/hash/shared/replace.rb +++ b/spec/ruby/core/hash/shared/replace.rb @@ -37,15 +37,15 @@ describe :hash_replace, shared: true do hash_a.default.should == hash_b.default end - it "raises a RuntimeError if called on a frozen instance that would not be modified" do + it "raises a #{frozen_error_class} if called on a frozen instance that would not be modified" do lambda do HashSpecs.frozen_hash.send(@method, HashSpecs.frozen_hash) - end.should raise_error(RuntimeError) + end.should raise_error(frozen_error_class) end - it "raises a RuntimeError if called on a frozen instance that is modified" do + it "raises a #{frozen_error_class} if called on a frozen instance that is modified" do lambda do HashSpecs.frozen_hash.send(@method, HashSpecs.empty_frozen_hash) - end.should raise_error(RuntimeError) + end.should raise_error(frozen_error_class) end end diff --git a/spec/ruby/core/hash/shared/store.rb b/spec/ruby/core/hash/shared/store.rb index b43dcbc93e..6f8390fd95 100644 --- a/spec/ruby/core/hash/shared/store.rb +++ b/spec/ruby/core/hash/shared/store.rb @@ -86,8 +86,8 @@ describe :hash_store, shared: true do h.keys.last.should_not equal(key2) end - it "raises a RuntimeError if called on a frozen instance" do - lambda { HashSpecs.frozen_hash.send(@method, 1, 2) }.should raise_error(RuntimeError) + it "raises a #{frozen_error_class} if called on a frozen instance" do + lambda { HashSpecs.frozen_hash.send(@method, 1, 2) }.should raise_error(frozen_error_class) end it "does not raise an exception if changing the value of an existing key during iteration" do diff --git a/spec/ruby/core/hash/shared/update.rb b/spec/ruby/core/hash/shared/update.rb index b1e3793028..be03ac019e 100644 --- a/spec/ruby/core/hash/shared/update.rb +++ b/spec/ruby/core/hash/shared/update.rb @@ -34,10 +34,10 @@ describe :hash_update, shared: true do merge_bang_pairs.should == merge_pairs end - it "raises a RuntimeError on a frozen instance that is modified" do + it "raises a #{frozen_error_class} on a frozen instance that is modified" do lambda do HashSpecs.frozen_hash.send(@method, 1 => 2) - end.should raise_error(RuntimeError) + end.should raise_error(frozen_error_class) end it "checks frozen status before coercing an object with #to_hash" do @@ -47,13 +47,13 @@ describe :hash_update, shared: true do def obj.to_hash() raise Exception, "should not receive #to_hash" end obj.freeze - lambda { HashSpecs.frozen_hash.send(@method, obj) }.should raise_error(RuntimeError) + lambda { HashSpecs.frozen_hash.send(@method, obj) }.should raise_error(frozen_error_class) end # see redmine #1571 - it "raises a RuntimeError on a frozen instance that would not be modified" do + it "raises a #{frozen_error_class} on a frozen instance that would not be modified" do lambda do HashSpecs.frozen_hash.send(@method, HashSpecs.empty_frozen_hash) - end.should raise_error(RuntimeError) + end.should raise_error(frozen_error_class) end end diff --git a/spec/ruby/core/hash/shift_spec.rb b/spec/ruby/core/hash/shift_spec.rb index 3991da9656..8476ef890a 100644 --- a/spec/ruby/core/hash/shift_spec.rb +++ b/spec/ruby/core/hash/shift_spec.rb @@ -57,8 +57,8 @@ describe "Hash#shift" do h.should == {:c => 3} end - it "raises a RuntimeError if called on a frozen instance" do - lambda { HashSpecs.frozen_hash.shift }.should raise_error(RuntimeError) - lambda { HashSpecs.empty_frozen_hash.shift }.should raise_error(RuntimeError) + it "raises a #{frozen_error_class} if called on a frozen instance" do + lambda { HashSpecs.frozen_hash.shift }.should raise_error(frozen_error_class) + lambda { HashSpecs.empty_frozen_hash.shift }.should raise_error(frozen_error_class) end end diff --git a/spec/ruby/core/hash/transform_keys_spec.rb b/spec/ruby/core/hash/transform_keys_spec.rb index 379638bd4b..7888486d42 100644 --- a/spec/ruby/core/hash/transform_keys_spec.rb +++ b/spec/ruby/core/hash/transform_keys_spec.rb @@ -91,12 +91,12 @@ ruby_version_is "2.5" do @hash.freeze end - it "raises a RuntimeError on an empty hash" do - ->{ {}.freeze.transform_keys!(&:upcase) }.should raise_error(RuntimeError) + it "raises a #{frozen_error_class} on an empty hash" do + ->{ {}.freeze.transform_keys!(&:upcase) }.should raise_error(frozen_error_class) end - it "keeps pairs and raises a RuntimeError" do - ->{ @hash.transform_keys!(&:upcase) }.should raise_error(RuntimeError) + it "keeps pairs and raises a #{frozen_error_class}" do + ->{ @hash.transform_keys!(&:upcase) }.should raise_error(frozen_error_class) @hash.should == @initial_pairs end diff --git a/spec/ruby/core/hash/transform_values_spec.rb b/spec/ruby/core/hash/transform_values_spec.rb index a9098a9f2d..5f928becb2 100644 --- a/spec/ruby/core/hash/transform_values_spec.rb +++ b/spec/ruby/core/hash/transform_values_spec.rb @@ -80,12 +80,12 @@ ruby_version_is "2.4" do @hash.freeze end - it "raises a RuntimeError on an empty hash" do - ->{ {}.freeze.transform_values!(&:succ) }.should raise_error(RuntimeError) + it "raises a #{frozen_error_class} on an empty hash" do + ->{ {}.freeze.transform_values!(&:succ) }.should raise_error(frozen_error_class) end - it "keeps pairs and raises a RuntimeError" do - ->{ @hash.transform_values!(&:succ) }.should raise_error(RuntimeError) + it "keeps pairs and raises a #{frozen_error_class}" do + ->{ @hash.transform_values!(&:succ) }.should raise_error(frozen_error_class) @hash.should == @initial_pairs end |