From 5c276e1cc91c5ab2a41fbf7827af2fed914a2bc0 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sat, 27 Jul 2019 12:40:09 +0200 Subject: Update to ruby/spec@875a09e --- spec/ruby/core/hash/clear_spec.rb | 4 ++-- spec/ruby/core/hash/compare_by_identity_spec.rb | 2 +- spec/ruby/core/hash/constructor_spec.rb | 6 +++--- spec/ruby/core/hash/default_proc_spec.rb | 18 +++++++++--------- spec/ruby/core/hash/default_spec.rb | 6 +++--- spec/ruby/core/hash/delete_if_spec.rb | 4 ++-- spec/ruby/core/hash/delete_spec.rb | 4 ++-- spec/ruby/core/hash/dig_spec.rb | 6 +++--- spec/ruby/core/hash/fetch_spec.rb | 14 +++++++------- spec/ruby/core/hash/fetch_values_spec.rb | 2 +- spec/ruby/core/hash/flatten_spec.rb | 2 +- spec/ruby/core/hash/initialize_spec.rb | 8 ++++---- spec/ruby/core/hash/keep_if_spec.rb | 4 ++-- spec/ruby/core/hash/merge_spec.rb | 2 +- spec/ruby/core/hash/new_spec.rb | 6 +++--- spec/ruby/core/hash/rehash_spec.rb | 4 ++-- spec/ruby/core/hash/reject_spec.rb | 4 ++-- spec/ruby/core/hash/shared/comparison.rb | 6 +++--- spec/ruby/core/hash/shared/replace.rb | 6 +++--- spec/ruby/core/hash/shared/select.rb | 4 ++-- spec/ruby/core/hash/shared/store.rb | 2 +- spec/ruby/core/hash/shared/to_s.rb | 2 +- spec/ruby/core/hash/shared/update.rb | 6 +++--- spec/ruby/core/hash/shift_spec.rb | 4 ++-- spec/ruby/core/hash/to_proc_spec.rb | 6 +++--- spec/ruby/core/hash/try_convert_spec.rb | 4 ++-- 26 files changed, 68 insertions(+), 68 deletions(-) (limited to 'spec/ruby/core/hash') diff --git a/spec/ruby/core/hash/clear_spec.rb b/spec/ruby/core/hash/clear_spec.rb index 706fe57e1c..e7816acbbc 100644 --- a/spec/ruby/core/hash/clear_spec.rb +++ b/spec/ruby/core/hash/clear_spec.rb @@ -26,7 +26,7 @@ describe "Hash#clear" do end 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) + -> { HashSpecs.frozen_hash.clear }.should raise_error(frozen_error_class) + -> { HashSpecs.empty_frozen_hash.clear }.should raise_error(frozen_error_class) 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 33db59124e..0658b4954a 100644 --- a/spec/ruby/core/hash/compare_by_identity_spec.rb +++ b/spec/ruby/core/hash/compare_by_identity_spec.rb @@ -82,7 +82,7 @@ describe "Hash#compare_by_identity" do it "raises a #{frozen_error_class} on frozen hashes" do @h = @h.freeze - lambda { @h.compare_by_identity }.should raise_error(frozen_error_class) + -> { @h.compare_by_identity }.should raise_error(frozen_error_class) end # Behaviour confirmed in bug #1871 diff --git a/spec/ruby/core/hash/constructor_spec.rb b/spec/ruby/core/hash/constructor_spec.rb index 14674a018b..ad67274802 100644 --- a/spec/ruby/core/hash/constructor_spec.rb +++ b/spec/ruby/core/hash/constructor_spec.rb @@ -65,7 +65,7 @@ describe "Hash.[]" do end it "raises an ArgumentError for arrays of more than 2 elements" do - lambda{ Hash[[[:a, :b, :c]]].should == {} }.should raise_error(ArgumentError) + ->{ Hash[[[:a, :b, :c]]].should == {} }.should raise_error(ArgumentError) end it "raises an ArgumentError when passed a list of value-invalid-pairs in an array" do @@ -89,8 +89,8 @@ describe "Hash.[]" do end it "raises an ArgumentError when passed an odd number of arguments" do - lambda { Hash[1, 2, 3] }.should raise_error(ArgumentError) - lambda { Hash[1, 2, { 3 => 4 }] }.should raise_error(ArgumentError) + -> { Hash[1, 2, 3] }.should raise_error(ArgumentError) + -> { Hash[1, 2, { 3 => 4 }] }.should raise_error(ArgumentError) end it "calls to_hash" do diff --git a/spec/ruby/core/hash/default_proc_spec.rb b/spec/ruby/core/hash/default_proc_spec.rb index 2254609607..83ad98e5b6 100644 --- a/spec/ruby/core/hash/default_proc_spec.rb +++ b/spec/ruby/core/hash/default_proc_spec.rb @@ -37,7 +37,7 @@ describe "Hash#default_proc=" do end it "raises an error if passed stuff not convertible to procs" do - lambda{{}.default_proc = 42}.should raise_error(TypeError) + ->{{}.default_proc = 42}.should raise_error(TypeError) end it "returns the passed Proc" do @@ -58,23 +58,23 @@ describe "Hash#default_proc=" do it "accepts a lambda with an arity of 2" do h = {} - lambda do - h.default_proc = lambda {|a,b| } + -> do + h.default_proc = -> a, b { } end.should_not raise_error(TypeError) end it "raises a TypeError if passed a lambda with an arity other than 2" do h = {} - lambda do - h.default_proc = lambda {|a| } + -> do + h.default_proc = -> a { } end.should raise_error(TypeError) - lambda do - h.default_proc = lambda {|a,b,c| } + -> do + h.default_proc = -> a, b, c { } end.should raise_error(TypeError) end 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) + -> { {}.freeze.default_proc = Proc.new {} }.should raise_error(frozen_error_class) + -> { {}.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 afc4f9780f..6cad65bb62 100644 --- a/spec/ruby/core/hash/default_spec.rb +++ b/spec/ruby/core/hash/default_spec.rb @@ -30,7 +30,7 @@ describe "Hash#default=" do end it "unsets the default proc" do - [99, nil, lambda { 6 }].each do |default| + [99, nil, -> { 6 }].each do |default| h = Hash.new { 5 } h.default_proc.should_not == nil h.default = default @@ -40,7 +40,7 @@ describe "Hash#default=" do end 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) + -> { HashSpecs.frozen_hash.default = nil }.should raise_error(frozen_error_class) + -> { 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 58fba1ff80..345a24a726 100644 --- a/spec/ruby/core/hash/delete_if_spec.rb +++ b/spec/ruby/core/hash/delete_if_spec.rb @@ -35,8 +35,8 @@ describe "Hash#delete_if" do end 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) + -> { HashSpecs.frozen_hash.delete_if { false } }.should raise_error(frozen_error_class) + -> { 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 6f0079dafa..a69815c1d9 100644 --- a/spec/ruby/core/hash/delete_spec.rb +++ b/spec/ruby/core/hash/delete_spec.rb @@ -38,7 +38,7 @@ describe "Hash#delete" do end 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) + -> { HashSpecs.frozen_hash.delete("foo") }.should raise_error(frozen_error_class) + -> { HashSpecs.empty_frozen_hash.delete("foo") }.should raise_error(frozen_error_class) end end diff --git a/spec/ruby/core/hash/dig_spec.rb b/spec/ruby/core/hash/dig_spec.rb index dcba049ac4..aa0ecadd2f 100644 --- a/spec/ruby/core/hash/dig_spec.rb +++ b/spec/ruby/core/hash/dig_spec.rb @@ -28,7 +28,7 @@ describe "Hash#dig" do end it "raises an ArgumentError if no arguments provided" do - lambda { { the: 'borg' }.dig() }.should raise_error(ArgumentError) + -> { { the: 'borg' }.dig() }.should raise_error(ArgumentError) end it "handles type-mixed deep digging" do @@ -47,8 +47,8 @@ describe "Hash#dig" do it "raises TypeError if an intermediate element does not respond to #dig" do h = {} h[:foo] = [ { bar: [ 1 ] }, [ nil, 'str' ] ] - lambda { h.dig(:foo, 0, :bar, 0, 0) }.should raise_error(TypeError) - lambda { h.dig(:foo, 1, 1, 0) }.should raise_error(TypeError) + -> { h.dig(:foo, 0, :bar, 0, 0) }.should raise_error(TypeError) + -> { h.dig(:foo, 1, 1, 0) }.should raise_error(TypeError) end it "calls #dig on the result of #[] with the remaining arguments" do diff --git a/spec/ruby/core/hash/fetch_spec.rb b/spec/ruby/core/hash/fetch_spec.rb index 197832e311..753167f709 100644 --- a/spec/ruby/core/hash/fetch_spec.rb +++ b/spec/ruby/core/hash/fetch_spec.rb @@ -4,10 +4,10 @@ require_relative '../../shared/hash/key_error' describe "Hash#fetch" do context "when the key is not found" do - it_behaves_like :key_error, ->(obj, key) { obj.fetch(key) }, Hash.new(a: 5) - it_behaves_like :key_error, ->(obj, key) { obj.fetch(key) }, {} - it_behaves_like :key_error, ->(obj, key) { obj.fetch(key) }, Hash.new { 5 } - it_behaves_like :key_error, ->(obj, key) { obj.fetch(key) }, Hash.new(5) + it_behaves_like :key_error, -> obj, key { obj.fetch(key) }, Hash.new(a: 5) + it_behaves_like :key_error, -> obj, key { obj.fetch(key) }, {} + it_behaves_like :key_error, -> obj, key { obj.fetch(key) }, Hash.new { 5 } + it_behaves_like :key_error, -> obj, key { obj.fetch(key) }, Hash.new(5) it "formats the object with #inspect in the KeyError message" do -> { @@ -31,14 +31,14 @@ describe "Hash#fetch" do end it "gives precedence to the default block over the default argument when passed both" do - lambda { + -> { @result = {}.fetch(9, :foo) { |i| i * i } }.should complain(/block supersedes default value argument/) @result.should == 81 end it "raises an ArgumentError when not passed one or two arguments" do - lambda { {}.fetch() }.should raise_error(ArgumentError) - lambda { {}.fetch(1, 2, 3) }.should raise_error(ArgumentError) + -> { {}.fetch() }.should raise_error(ArgumentError) + -> { {}.fetch(1, 2, 3) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/core/hash/fetch_values_spec.rb b/spec/ruby/core/hash/fetch_values_spec.rb index a4af153bf7..041a3f07e9 100644 --- a/spec/ruby/core/hash/fetch_values_spec.rb +++ b/spec/ruby/core/hash/fetch_values_spec.rb @@ -15,7 +15,7 @@ describe "Hash#fetch_values" do end describe "with unmatched keys" do - it_behaves_like :key_error, ->(obj, key) { obj.fetch_values(key) }, Hash.new(a: 5) + it_behaves_like :key_error, -> obj, key { obj.fetch_values(key) }, Hash.new(a: 5) it "returns the default value from block" do @hash.fetch_values(:z) { |key| "`#{key}' is not found" }.should == ["`z' is not found"] diff --git a/spec/ruby/core/hash/flatten_spec.rb b/spec/ruby/core/hash/flatten_spec.rb index 5a7ddd8baa..825da15bfc 100644 --- a/spec/ruby/core/hash/flatten_spec.rb +++ b/spec/ruby/core/hash/flatten_spec.rb @@ -55,7 +55,7 @@ describe "Hash#flatten" do end it "raises a TypeError if given a non-Integer argument" do - lambda do + -> do @h.flatten(Object.new) end.should raise_error(TypeError) end diff --git a/spec/ruby/core/hash/initialize_spec.rb b/spec/ruby/core/hash/initialize_spec.rb index 344571631a..00e1174ec8 100644 --- a/spec/ruby/core/hash/initialize_spec.rb +++ b/spec/ruby/core/hash/initialize_spec.rb @@ -46,16 +46,16 @@ describe "Hash#initialize" do end it "raises a #{frozen_error_class} if called on a frozen instance" do - block = lambda { HashSpecs.frozen_hash.instance_eval { initialize() }} + block = -> { HashSpecs.frozen_hash.instance_eval { initialize() }} block.should raise_error(frozen_error_class) - block = lambda { HashSpecs.frozen_hash.instance_eval { initialize(nil) } } + block = -> { HashSpecs.frozen_hash.instance_eval { initialize(nil) } } block.should raise_error(frozen_error_class) - block = lambda { HashSpecs.frozen_hash.instance_eval { initialize(5) } } + block = -> { HashSpecs.frozen_hash.instance_eval { initialize(5) } } block.should raise_error(frozen_error_class) - block = lambda { HashSpecs.frozen_hash.instance_eval { initialize { 5 } } } + block = -> { HashSpecs.frozen_hash.instance_eval { initialize { 5 } } } 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 80f7fbbf64..278eafc969 100644 --- a/spec/ruby/core/hash/keep_if_spec.rb +++ b/spec/ruby/core/hash/keep_if_spec.rb @@ -28,8 +28,8 @@ describe "Hash#keep_if" do end 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) + -> { HashSpecs.frozen_hash.keep_if { true } }.should raise_error(frozen_error_class) + -> { 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/merge_spec.rb b/spec/ruby/core/hash/merge_spec.rb index 77e5c42071..91ded30eb7 100644 --- a/spec/ruby/core/hash/merge_spec.rb +++ b/spec/ruby/core/hash/merge_spec.rb @@ -28,7 +28,7 @@ describe "Hash#merge" do r = h1.merge(h2) { |k,x,y| "#{k}:#{x+2*y}" } r.should == { a: "a:-2", b: "b:9", c: -3, d: 5 } - lambda { + -> { h1.merge(h2) { |k, x, y| raise(IndexError) } }.should raise_error(IndexError) diff --git a/spec/ruby/core/hash/new_spec.rb b/spec/ruby/core/hash/new_spec.rb index c21266777f..6054b69bdd 100644 --- a/spec/ruby/core/hash/new_spec.rb +++ b/spec/ruby/core/hash/new_spec.rb @@ -26,11 +26,11 @@ describe "Hash.new" do end it "raises an ArgumentError if more than one argument is passed" do - lambda { Hash.new(5,6) }.should raise_error(ArgumentError) + -> { Hash.new(5,6) }.should raise_error(ArgumentError) end it "raises an ArgumentError if passed both default argument and default block" do - lambda { Hash.new(5) { 0 } }.should raise_error(ArgumentError) - lambda { Hash.new(nil) { 0 } }.should raise_error(ArgumentError) + -> { Hash.new(5) { 0 } }.should raise_error(ArgumentError) + -> { Hash.new(nil) { 0 } }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/core/hash/rehash_spec.rb b/spec/ruby/core/hash/rehash_spec.rb index 32ba3fcfb9..9816648f08 100644 --- a/spec/ruby/core/hash/rehash_spec.rb +++ b/spec/ruby/core/hash/rehash_spec.rb @@ -51,7 +51,7 @@ describe "Hash#rehash" do end 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) + -> { HashSpecs.frozen_hash.rehash }.should raise_error(frozen_error_class) + -> { 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 a11e80a34a..8016be5e83 100644 --- a/spec/ruby/core/hash/reject_spec.rb +++ b/spec/ruby/core/hash/reject_spec.rb @@ -88,11 +88,11 @@ describe "Hash#reject!" do end 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) + -> { HashSpecs.empty_frozen_hash.reject! { true } }.should raise_error(frozen_error_class) end 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) + -> { 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/shared/comparison.rb b/spec/ruby/core/hash/shared/comparison.rb index bbb9bfd6ad..07564e4cec 100644 --- a/spec/ruby/core/hash/shared/comparison.rb +++ b/spec/ruby/core/hash/shared/comparison.rb @@ -1,8 +1,8 @@ describe :hash_comparison, shared: true do it "raises a TypeError if the right operand is not a hash" do - lambda { { a: 1 }.send(@method, 1) }.should raise_error(TypeError) - lambda { { a: 1 }.send(@method, nil) }.should raise_error(TypeError) - lambda { { a: 1 }.send(@method, []) }.should raise_error(TypeError) + -> { { a: 1 }.send(@method, 1) }.should raise_error(TypeError) + -> { { a: 1 }.send(@method, nil) }.should raise_error(TypeError) + -> { { a: 1 }.send(@method, []) }.should raise_error(TypeError) end it "returns false if both hashes have the same keys but different values" do diff --git a/spec/ruby/core/hash/shared/replace.rb b/spec/ruby/core/hash/shared/replace.rb index eb51130781..b3d098763b 100644 --- a/spec/ruby/core/hash/shared/replace.rb +++ b/spec/ruby/core/hash/shared/replace.rb @@ -32,19 +32,19 @@ describe :hash_replace, shared: true do hash_a.default(5).should == 10 hash_a = Hash.new { |h, k| k * 5 } - hash_b = Hash.new(lambda { raise "Should not invoke lambda" }) + hash_b = Hash.new(-> { raise "Should not invoke lambda" }) hash_a.send(@method, hash_b) hash_a.default.should == hash_b.default end it "raises a #{frozen_error_class} if called on a frozen instance that would not be modified" do - lambda do + -> do HashSpecs.frozen_hash.send(@method, HashSpecs.frozen_hash) end.should raise_error(frozen_error_class) end it "raises a #{frozen_error_class} if called on a frozen instance that is modified" do - lambda do + -> do HashSpecs.frozen_hash.send(@method, HashSpecs.empty_frozen_hash) end.should raise_error(frozen_error_class) end diff --git a/spec/ruby/core/hash/shared/select.rb b/spec/ruby/core/hash/shared/select.rb index cc1a54da25..bb781817cb 100644 --- a/spec/ruby/core/hash/shared/select.rb +++ b/spec/ruby/core/hash/shared/select.rb @@ -75,11 +75,11 @@ describe :hash_select!, shared: true do end it "raises a #{frozen_error_class} if called on an empty frozen instance" do - lambda { HashSpecs.empty_frozen_hash.send(@method) { false } }.should raise_error(frozen_error_class) + -> { HashSpecs.empty_frozen_hash.send(@method) { false } }.should raise_error(frozen_error_class) end it "raises a #{frozen_error_class} if called on a frozen instance that would not be modified" do - lambda { HashSpecs.frozen_hash.send(@method) { true } }.should raise_error(frozen_error_class) + -> { HashSpecs.frozen_hash.send(@method) { true } }.should raise_error(frozen_error_class) end it_should_behave_like :hash_iteration_no_block diff --git a/spec/ruby/core/hash/shared/store.rb b/spec/ruby/core/hash/shared/store.rb index de61ed1ad1..ff40bef3ef 100644 --- a/spec/ruby/core/hash/shared/store.rb +++ b/spec/ruby/core/hash/shared/store.rb @@ -87,7 +87,7 @@ describe :hash_store, shared: true do end 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) + -> { 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/to_s.rb b/spec/ruby/core/hash/shared/to_s.rb index 88333e0f42..d180d08c2c 100644 --- a/spec/ruby/core/hash/shared/to_s.rb +++ b/spec/ruby/core/hash/shared/to_s.rb @@ -61,7 +61,7 @@ describe :hash_to_s, shared: true do obj.should_receive(:inspect).and_return(obj) obj.should_receive(:to_s).and_raise(Exception) - lambda { { a: obj }.send(@method) }.should raise_error(Exception) + -> { { a: obj }.send(@method) }.should raise_error(Exception) end it "handles hashes with recursive values" do diff --git a/spec/ruby/core/hash/shared/update.rb b/spec/ruby/core/hash/shared/update.rb index e808add5c0..3af41c450a 100644 --- a/spec/ruby/core/hash/shared/update.rb +++ b/spec/ruby/core/hash/shared/update.rb @@ -35,7 +35,7 @@ describe :hash_update, shared: true do end it "raises a #{frozen_error_class} on a frozen instance that is modified" do - lambda do + -> do HashSpecs.frozen_hash.send(@method, 1 => 2) end.should raise_error(frozen_error_class) end @@ -47,12 +47,12 @@ 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(frozen_error_class) + -> { HashSpecs.frozen_hash.send(@method, obj) }.should raise_error(frozen_error_class) end # see redmine #1571 it "raises a #{frozen_error_class} on a frozen instance that would not be modified" do - lambda do + -> do HashSpecs.frozen_hash.send(@method, HashSpecs.empty_frozen_hash) end.should raise_error(frozen_error_class) end diff --git a/spec/ruby/core/hash/shift_spec.rb b/spec/ruby/core/hash/shift_spec.rb index 47c9ac1821..d9f121e38b 100644 --- a/spec/ruby/core/hash/shift_spec.rb +++ b/spec/ruby/core/hash/shift_spec.rb @@ -58,8 +58,8 @@ describe "Hash#shift" do end 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) + -> { HashSpecs.frozen_hash.shift }.should raise_error(frozen_error_class) + -> { HashSpecs.empty_frozen_hash.shift }.should raise_error(frozen_error_class) end it "works when the hash is at capacity" do diff --git a/spec/ruby/core/hash/to_proc_spec.rb b/spec/ruby/core/hash/to_proc_spec.rb index ca55604043..3e7e57d11f 100644 --- a/spec/ruby/core/hash/to_proc_spec.rb +++ b/spec/ruby/core/hash/to_proc_spec.rb @@ -24,11 +24,11 @@ describe "Hash#to_proc" do end it "raises ArgumentError if not passed exactly one argument" do - lambda { + -> { @proc.call }.should raise_error(ArgumentError) - lambda { + -> { @proc.call 1, 2 }.should raise_error(ArgumentError) end @@ -81,7 +81,7 @@ describe "Hash#to_proc" do end it "raises an ArgumentError when calling #call on the Proc with no arguments" do - lambda { @hash.to_proc.call }.should raise_error(ArgumentError) + -> { @hash.to_proc.call }.should raise_error(ArgumentError) end end end diff --git a/spec/ruby/core/hash/try_convert_spec.rb b/spec/ruby/core/hash/try_convert_spec.rb index 50bb59816c..44195c5010 100644 --- a/spec/ruby/core/hash/try_convert_spec.rb +++ b/spec/ruby/core/hash/try_convert_spec.rb @@ -39,12 +39,12 @@ describe "Hash.try_convert" do it "sends #to_hash to the argument and raises TypeError if it's not a kind of Hash" do obj = mock("to_hash") obj.should_receive(:to_hash).and_return(Object.new) - lambda { Hash.try_convert obj }.should raise_error(TypeError) + -> { Hash.try_convert obj }.should raise_error(TypeError) end it "does not rescue exceptions raised by #to_hash" do obj = mock("to_hash") obj.should_receive(:to_hash).and_raise(RuntimeError) - lambda { Hash.try_convert obj }.should raise_error(RuntimeError) + -> { Hash.try_convert obj }.should raise_error(RuntimeError) end end -- cgit v1.2.3