diff options
author | Benoit Daloze <eregontp@gmail.com> | 2019-07-27 12:40:09 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2019-07-27 12:40:09 +0200 |
commit | 5c276e1cc91c5ab2a41fbf7827af2fed914a2bc0 (patch) | |
tree | 05b5c68c8b2a00224d4646ea3b26ce3877efaadd /spec/ruby/core/integer/shared | |
parent | a06301b103371b0b7da8eaca26ba744961769f99 (diff) | |
download | ruby-5c276e1cc91c5ab2a41fbf7827af2fed914a2bc0.tar.gz |
Update to ruby/spec@875a09e
Diffstat (limited to 'spec/ruby/core/integer/shared')
-rw-r--r-- | spec/ruby/core/integer/shared/exponent.rb | 6 | ||||
-rw-r--r-- | spec/ruby/core/integer/shared/modulo.rb | 32 |
2 files changed, 19 insertions, 19 deletions
diff --git a/spec/ruby/core/integer/shared/exponent.rb b/spec/ruby/core/integer/shared/exponent.rb index 810e2a7101..f292cc2448 100644 --- a/spec/ruby/core/integer/shared/exponent.rb +++ b/spec/ruby/core/integer/shared/exponent.rb @@ -99,9 +99,9 @@ describe :integer_exponent, shared: true do end it "raises a TypeError when given a non-Integer" do - lambda { @bignum.send(@method, mock('10')) }.should raise_error(TypeError) - lambda { @bignum.send(@method, "10") }.should raise_error(TypeError) - lambda { @bignum.send(@method, :symbol) }.should raise_error(TypeError) + -> { @bignum.send(@method, mock('10')) }.should raise_error(TypeError) + -> { @bignum.send(@method, "10") }.should raise_error(TypeError) + -> { @bignum.send(@method, :symbol) }.should raise_error(TypeError) end it "switch to a Float when the values is too big" do diff --git a/spec/ruby/core/integer/shared/modulo.rb b/spec/ruby/core/integer/shared/modulo.rb index d545a9af55..b06d81e17d 100644 --- a/spec/ruby/core/integer/shared/modulo.rb +++ b/spec/ruby/core/integer/shared/modulo.rb @@ -21,24 +21,24 @@ describe :integer_modulo, shared: true do end it "raises a ZeroDivisionError when the given argument is 0" do - lambda { 13.send(@method, 0) }.should raise_error(ZeroDivisionError) - lambda { 0.send(@method, 0) }.should raise_error(ZeroDivisionError) - lambda { -10.send(@method, 0) }.should raise_error(ZeroDivisionError) + -> { 13.send(@method, 0) }.should raise_error(ZeroDivisionError) + -> { 0.send(@method, 0) }.should raise_error(ZeroDivisionError) + -> { -10.send(@method, 0) }.should raise_error(ZeroDivisionError) end it "raises a ZeroDivisionError when the given argument is 0 and a Float" do - lambda { 0.send(@method, 0.0) }.should raise_error(ZeroDivisionError) - lambda { 10.send(@method, 0.0) }.should raise_error(ZeroDivisionError) - lambda { -10.send(@method, 0.0) }.should raise_error(ZeroDivisionError) + -> { 0.send(@method, 0.0) }.should raise_error(ZeroDivisionError) + -> { 10.send(@method, 0.0) }.should raise_error(ZeroDivisionError) + -> { -10.send(@method, 0.0) }.should raise_error(ZeroDivisionError) end it "raises a TypeError when given a non-Integer" do - lambda { + -> { (obj = mock('10')).should_receive(:to_int).any_number_of_times.and_return(10) 13.send(@method, obj) }.should raise_error(TypeError) - lambda { 13.send(@method, "10") }.should raise_error(TypeError) - lambda { 13.send(@method, :symbol) }.should raise_error(TypeError) + -> { 13.send(@method, "10") }.should raise_error(TypeError) + -> { 13.send(@method, :symbol) }.should raise_error(TypeError) end end @@ -56,19 +56,19 @@ describe :integer_modulo, shared: true do end it "raises a ZeroDivisionError when the given argument is 0" do - lambda { @bignum.send(@method, 0) }.should raise_error(ZeroDivisionError) - lambda { (-@bignum).send(@method, 0) }.should raise_error(ZeroDivisionError) + -> { @bignum.send(@method, 0) }.should raise_error(ZeroDivisionError) + -> { (-@bignum).send(@method, 0) }.should raise_error(ZeroDivisionError) end it "raises a ZeroDivisionError when the given argument is 0 and a Float" do - lambda { @bignum.send(@method, 0.0) }.should raise_error(ZeroDivisionError) - lambda { -@bignum.send(@method, 0.0) }.should raise_error(ZeroDivisionError) + -> { @bignum.send(@method, 0.0) }.should raise_error(ZeroDivisionError) + -> { -@bignum.send(@method, 0.0) }.should raise_error(ZeroDivisionError) end it "raises a TypeError when given a non-Integer" do - lambda { @bignum.send(@method, mock('10')) }.should raise_error(TypeError) - lambda { @bignum.send(@method, "10") }.should raise_error(TypeError) - lambda { @bignum.send(@method, :symbol) }.should raise_error(TypeError) + -> { @bignum.send(@method, mock('10')) }.should raise_error(TypeError) + -> { @bignum.send(@method, "10") }.should raise_error(TypeError) + -> { @bignum.send(@method, :symbol) }.should raise_error(TypeError) end end end |