diff options
Diffstat (limited to 'spec/ruby/library')
429 files changed, 1245 insertions, 1213 deletions
diff --git a/spec/ruby/library/abbrev/abbrev_spec.rb b/spec/ruby/library/abbrev/abbrev_spec.rb index 60d1a953b3..61b0926597 100644 --- a/spec/ruby/library/abbrev/abbrev_spec.rb +++ b/spec/ruby/library/abbrev/abbrev_spec.rb @@ -5,8 +5,8 @@ require 'abbrev' #the same manner, as they're more or less aliases #of one another -[["Abbrev.abbrev", lambda {|a| Abbrev.abbrev(a)}], - ["Array#abbrev", lambda {|a| a.abbrev}] +[["Abbrev.abbrev", -> a { Abbrev.abbrev(a)}], + ["Array#abbrev", -> a { a.abbrev}] ].each do |(name, func)| describe name do diff --git a/spec/ruby/library/bigdecimal/BigDecimal_spec.rb b/spec/ruby/library/bigdecimal/BigDecimal_spec.rb index ec38c6f113..e1e6fe9fb1 100644 --- a/spec/ruby/library/bigdecimal/BigDecimal_spec.rb +++ b/spec/ruby/library/bigdecimal/BigDecimal_spec.rb @@ -51,16 +51,16 @@ describe "Kernel#BigDecimal" do ruby_version_is "2.6" do it "does not ignores trailing garbage" do - lambda { BigDecimal("123E45ruby") }.should raise_error(ArgumentError) - lambda { BigDecimal("123x45") }.should raise_error(ArgumentError) - lambda { BigDecimal("123.4%E5") }.should raise_error(ArgumentError) - lambda { BigDecimal("1E2E3E4E5E") }.should raise_error(ArgumentError) + -> { BigDecimal("123E45ruby") }.should raise_error(ArgumentError) + -> { BigDecimal("123x45") }.should raise_error(ArgumentError) + -> { BigDecimal("123.4%E5") }.should raise_error(ArgumentError) + -> { BigDecimal("1E2E3E4E5E") }.should raise_error(ArgumentError) end end it "raises ArgumentError for invalid strings" do - lambda { BigDecimal("ruby") }.should raise_error(ArgumentError) - lambda { BigDecimal(" \t\n \r-\t\t\tInfinity \n") }.should raise_error(ArgumentError) + -> { BigDecimal("ruby") }.should raise_error(ArgumentError) + -> { BigDecimal(" \t\n \r-\t\t\tInfinity \n") }.should raise_error(ArgumentError) end it "allows omitting the integer part" do @@ -82,8 +82,8 @@ describe "Kernel#BigDecimal" do reference = BigDecimal("12345.67E89") BigDecimal("12_345.67E89").should == reference - lambda { BigDecimal("1_2_3_4_5_._6____7_E89") }.should raise_error(ArgumentError) - lambda { BigDecimal("12345_.67E_8__9_") }.should raise_error(ArgumentError) + -> { BigDecimal("1_2_3_4_5_._6____7_E89") }.should raise_error(ArgumentError) + -> { BigDecimal("12345_.67E_8__9_") }.should raise_error(ArgumentError) end end @@ -151,7 +151,7 @@ describe "Kernel#BigDecimal" do end it "raises ArgumentError when Float is used without precision" do - lambda { BigDecimal(1.0) }.should raise_error(ArgumentError) + -> { BigDecimal(1.0) }.should raise_error(ArgumentError) end it "returns appropriate BigDecimal zero for signed zero" do diff --git a/spec/ruby/library/bigdecimal/add_spec.rb b/spec/ruby/library/bigdecimal/add_spec.rb index 1ae5b7f428..5b874687fe 100644 --- a/spec/ruby/library/bigdecimal/add_spec.rb +++ b/spec/ruby/library/bigdecimal/add_spec.rb @@ -81,6 +81,12 @@ describe "BigDecimal#add" do end end + describe "with Rational" do + it "produces a BigDecimal" do + (@three + Rational(500, 2)).should == BigDecimal("0.253e3") + end + end + it "favors the precision specified in the second argument over the global limit" do BigDecimalSpecs.with_limit(1) do BigDecimal('0.888').add(@zero, 3).should == BigDecimal('0.888') @@ -165,22 +171,22 @@ describe "BigDecimal#add" do end it "raises TypeError when adds nil" do - lambda { + -> { @one.add(nil, 10) }.should raise_error(TypeError) - lambda { + -> { @one.add(nil, 0) }.should raise_error(TypeError) end it "raises TypeError when precision parameter is nil" do - lambda { + -> { @one.add(@one, nil) }.should raise_error(TypeError) end it "raises ArgumentError when precision parameter is negative" do - lambda { + -> { @one.add(@one, -10) }.should raise_error(ArgumentError) end diff --git a/spec/ruby/library/bigdecimal/ceil_spec.rb b/spec/ruby/library/bigdecimal/ceil_spec.rb index 879c4fcf36..60e71b12fb 100644 --- a/spec/ruby/library/bigdecimal/ceil_spec.rb +++ b/spec/ruby/library/bigdecimal/ceil_spec.rb @@ -48,9 +48,9 @@ describe "BigDecimal#ceil" do end it "raise exception, if self is special value" do - lambda { @infinity.ceil }.should raise_error(FloatDomainError) - lambda { @infinity_neg.ceil }.should raise_error(FloatDomainError) - lambda { @nan.ceil }.should raise_error(FloatDomainError) + -> { @infinity.ceil }.should raise_error(FloatDomainError) + -> { @infinity_neg.ceil }.should raise_error(FloatDomainError) + -> { @nan.ceil }.should raise_error(FloatDomainError) end it "returns n digits right of the decimal point if given n > 0" do diff --git a/spec/ruby/library/bigdecimal/div_spec.rb b/spec/ruby/library/bigdecimal/div_spec.rb index 23d1ae1efd..0c9eb2ddec 100644 --- a/spec/ruby/library/bigdecimal/div_spec.rb +++ b/spec/ruby/library/bigdecimal/div_spec.rb @@ -51,9 +51,9 @@ describe "BigDecimal#div" do end it "raises FloatDomainError if NaN is involved" do - lambda { @one.div(@nan) }.should raise_error(FloatDomainError) - lambda { @nan.div(@one) }.should raise_error(FloatDomainError) - lambda { @nan.div(@nan) }.should raise_error(FloatDomainError) + -> { @one.div(@nan) }.should raise_error(FloatDomainError) + -> { @nan.div(@one) }.should raise_error(FloatDomainError) + -> { @nan.div(@nan) }.should raise_error(FloatDomainError) end it "returns 0 if divided by Infinity and no precision given" do @@ -69,14 +69,14 @@ describe "BigDecimal#div" do end it "raises ZeroDivisionError if divided by zero and no precision given" do - lambda { @one.div(@zero) }.should raise_error(ZeroDivisionError) - lambda { @one.div(@zero_plus) }.should raise_error(ZeroDivisionError) - lambda { @one.div(@zero_minus) }.should raise_error(ZeroDivisionError) - - lambda { @zero.div(@zero) }.should raise_error(ZeroDivisionError) - lambda { @zero_minus.div(@zero_plus) }.should raise_error(ZeroDivisionError) - lambda { @zero_minus.div(@zero_minus) }.should raise_error(ZeroDivisionError) - lambda { @zero_plus.div(@zero_minus) }.should raise_error(ZeroDivisionError) + -> { @one.div(@zero) }.should raise_error(ZeroDivisionError) + -> { @one.div(@zero_plus) }.should raise_error(ZeroDivisionError) + -> { @one.div(@zero_minus) }.should raise_error(ZeroDivisionError) + + -> { @zero.div(@zero) }.should raise_error(ZeroDivisionError) + -> { @zero_minus.div(@zero_plus) }.should raise_error(ZeroDivisionError) + -> { @zero_minus.div(@zero_minus) }.should raise_error(ZeroDivisionError) + -> { @zero_plus.div(@zero_minus) }.should raise_error(ZeroDivisionError) end it "returns NaN if zero is divided by zero" do @@ -90,9 +90,9 @@ describe "BigDecimal#div" do end it "raises FloatDomainError if (+|-) Infinity divided by 1 and no precision given" do - lambda { @infinity_minus.div(@one) }.should raise_error(FloatDomainError) - lambda { @infinity.div(@one) }.should raise_error(FloatDomainError) - lambda { @infinity_minus.div(@one_minus) }.should raise_error(FloatDomainError) + -> { @infinity_minus.div(@one) }.should raise_error(FloatDomainError) + -> { @infinity.div(@one) }.should raise_error(FloatDomainError) + -> { @infinity_minus.div(@one_minus) }.should raise_error(FloatDomainError) end it "returns (+|-)Infinity if (+|-)Infinity by 1 and precision given" do diff --git a/spec/ruby/library/bigdecimal/divide_spec.rb b/spec/ruby/library/bigdecimal/divide_spec.rb index 2aac99799f..c62b23557d 100644 --- a/spec/ruby/library/bigdecimal/divide_spec.rb +++ b/spec/ruby/library/bigdecimal/divide_spec.rb @@ -4,4 +4,14 @@ require 'bigdecimal' describe "BigDecimal#/" do it_behaves_like :bigdecimal_quo, :/, [] + + before :each do + @three = BigDecimal("3") + end + + describe "with Rational" do + it "produces a BigDecimal" do + (@three / Rational(500, 2)).should == BigDecimal("0.12e-1") + end + end end diff --git a/spec/ruby/library/bigdecimal/divmod_spec.rb b/spec/ruby/library/bigdecimal/divmod_spec.rb index 3946d6f208..ae8b84983a 100644 --- a/spec/ruby/library/bigdecimal/divmod_spec.rb +++ b/spec/ruby/library/bigdecimal/divmod_spec.rb @@ -38,9 +38,9 @@ describe "BigDecimal#mod_part_of_divmod" do it "raises ZeroDivisionError if other is zero" do bd5667 = BigDecimal("5667.19") - lambda { bd5667.mod_part_of_divmod(0) }.should raise_error(ZeroDivisionError) - lambda { bd5667.mod_part_of_divmod(BigDecimal("0")) }.should raise_error(ZeroDivisionError) - lambda { @zero.mod_part_of_divmod(@zero) }.should raise_error(ZeroDivisionError) + -> { bd5667.mod_part_of_divmod(0) }.should raise_error(ZeroDivisionError) + -> { bd5667.mod_part_of_divmod(BigDecimal("0")) }.should raise_error(ZeroDivisionError) + -> { @zero.mod_part_of_divmod(@zero) }.should raise_error(ZeroDivisionError) end end @@ -140,7 +140,7 @@ describe "BigDecimal#divmod" do it "raises ZeroDivisionError if the divisor is zero" do (@special_vals + @regular_vals + @zeroes - [@nan]).each do |val| @zeroes.each do |zero| - lambda { val.divmod(zero) }.should raise_error(ZeroDivisionError) + -> { val.divmod(zero) }.should raise_error(ZeroDivisionError) end end end @@ -172,7 +172,7 @@ describe "BigDecimal#divmod" do end it "raises TypeError if the argument cannot be coerced to BigDecimal" do - lambda { + -> { @one.divmod('1') }.should raise_error(TypeError) end diff --git a/spec/ruby/library/bigdecimal/fix_spec.rb b/spec/ruby/library/bigdecimal/fix_spec.rb index af852d6471..53b30cbf8b 100644 --- a/spec/ruby/library/bigdecimal/fix_spec.rb +++ b/spec/ruby/library/bigdecimal/fix_spec.rb @@ -49,7 +49,7 @@ describe "BigDecimal#fix" do end it "does not allow any arguments" do - lambda { + -> { @mixed.fix(10) }.should raise_error(ArgumentError) end diff --git a/spec/ruby/library/bigdecimal/floor_spec.rb b/spec/ruby/library/bigdecimal/floor_spec.rb index 509cb00e10..a7dfec2c9a 100644 --- a/spec/ruby/library/bigdecimal/floor_spec.rb +++ b/spec/ruby/library/bigdecimal/floor_spec.rb @@ -41,9 +41,9 @@ describe "BigDecimal#floor" do end it "raise exception, if self is special value" do - lambda { @infinity.floor }.should raise_error(FloatDomainError) - lambda { @infinity_neg.floor }.should raise_error(FloatDomainError) - lambda { @nan.floor }.should raise_error(FloatDomainError) + -> { @infinity.floor }.should raise_error(FloatDomainError) + -> { @infinity_neg.floor }.should raise_error(FloatDomainError) + -> { @nan.floor }.should raise_error(FloatDomainError) end it "returns n digits right of the decimal point if given n > 0" do diff --git a/spec/ruby/library/bigdecimal/gt_spec.rb b/spec/ruby/library/bigdecimal/gt_spec.rb index 8ebb631cb8..4717cfdd9d 100644 --- a/spec/ruby/library/bigdecimal/gt_spec.rb +++ b/spec/ruby/library/bigdecimal/gt_spec.rb @@ -86,11 +86,11 @@ describe "BigDecimal#>" do end it "raises an ArgumentError if the argument can't be coerced into a BigDecimal" do - lambda {@zero > nil }.should raise_error(ArgumentError) - lambda {@infinity > nil }.should raise_error(ArgumentError) - lambda {@infinity_neg > nil }.should raise_error(ArgumentError) - lambda {@mixed > nil }.should raise_error(ArgumentError) - lambda {@pos_int > nil }.should raise_error(ArgumentError) - lambda {@neg_frac > nil }.should raise_error(ArgumentError) + -> {@zero > nil }.should raise_error(ArgumentError) + -> {@infinity > nil }.should raise_error(ArgumentError) + -> {@infinity_neg > nil }.should raise_error(ArgumentError) + -> {@mixed > nil }.should raise_error(ArgumentError) + -> {@pos_int > nil }.should raise_error(ArgumentError) + -> {@neg_frac > nil }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/bigdecimal/gte_spec.rb b/spec/ruby/library/bigdecimal/gte_spec.rb index 6b0b7f41e9..8dc81707f0 100644 --- a/spec/ruby/library/bigdecimal/gte_spec.rb +++ b/spec/ruby/library/bigdecimal/gte_spec.rb @@ -90,11 +90,11 @@ describe "BigDecimal#>=" do end it "returns nil if the argument is nil" do - lambda {@zero >= nil }.should raise_error(ArgumentError) - lambda {@infinity >= nil }.should raise_error(ArgumentError) - lambda {@infinity_neg >= nil }.should raise_error(ArgumentError) - lambda {@mixed >= nil }.should raise_error(ArgumentError) - lambda {@pos_int >= nil }.should raise_error(ArgumentError) - lambda {@neg_frac >= nil }.should raise_error(ArgumentError) + -> {@zero >= nil }.should raise_error(ArgumentError) + -> {@infinity >= nil }.should raise_error(ArgumentError) + -> {@infinity_neg >= nil }.should raise_error(ArgumentError) + -> {@mixed >= nil }.should raise_error(ArgumentError) + -> {@pos_int >= nil }.should raise_error(ArgumentError) + -> {@neg_frac >= nil }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/bigdecimal/lt_spec.rb b/spec/ruby/library/bigdecimal/lt_spec.rb index 1894daf17f..61f4f19912 100644 --- a/spec/ruby/library/bigdecimal/lt_spec.rb +++ b/spec/ruby/library/bigdecimal/lt_spec.rb @@ -84,11 +84,11 @@ describe "BigDecimal#<" do end it "raises an ArgumentError if the argument can't be coerced into a BigDecimal" do - lambda {@zero < nil }.should raise_error(ArgumentError) - lambda {@infinity < nil }.should raise_error(ArgumentError) - lambda {@infinity_neg < nil }.should raise_error(ArgumentError) - lambda {@mixed < nil }.should raise_error(ArgumentError) - lambda {@pos_int < nil }.should raise_error(ArgumentError) - lambda {@neg_frac < nil }.should raise_error(ArgumentError) + -> {@zero < nil }.should raise_error(ArgumentError) + -> {@infinity < nil }.should raise_error(ArgumentError) + -> {@infinity_neg < nil }.should raise_error(ArgumentError) + -> {@mixed < nil }.should raise_error(ArgumentError) + -> {@pos_int < nil }.should raise_error(ArgumentError) + -> {@neg_frac < nil }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/bigdecimal/lte_spec.rb b/spec/ruby/library/bigdecimal/lte_spec.rb index 56d3caa3b1..fc632315f8 100644 --- a/spec/ruby/library/bigdecimal/lte_spec.rb +++ b/spec/ruby/library/bigdecimal/lte_spec.rb @@ -90,11 +90,11 @@ describe "BigDecimal#<=" do end it "raises an ArgumentError if the argument can't be coerced into a BigDecimal" do - lambda {@zero <= nil }.should raise_error(ArgumentError) - lambda {@infinity <= nil }.should raise_error(ArgumentError) - lambda {@infinity_neg <= nil }.should raise_error(ArgumentError) - lambda {@mixed <= nil }.should raise_error(ArgumentError) - lambda {@pos_int <= nil }.should raise_error(ArgumentError) - lambda {@neg_frac <= nil }.should raise_error(ArgumentError) + -> {@zero <= nil }.should raise_error(ArgumentError) + -> {@infinity <= nil }.should raise_error(ArgumentError) + -> {@infinity_neg <= nil }.should raise_error(ArgumentError) + -> {@mixed <= nil }.should raise_error(ArgumentError) + -> {@pos_int <= nil }.should raise_error(ArgumentError) + -> {@neg_frac <= nil }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/bigdecimal/mode_spec.rb b/spec/ruby/library/bigdecimal/mode_spec.rb index 1de19c9971..f57028ae5d 100644 --- a/spec/ruby/library/bigdecimal/mode_spec.rb +++ b/spec/ruby/library/bigdecimal/mode_spec.rb @@ -24,13 +24,13 @@ describe "BigDecimal.mode" do it "raise an exception if the flag is true" do BigDecimal.mode(BigDecimal::EXCEPTION_NaN, true) - lambda { BigDecimal("NaN").add(BigDecimal("1"),0) }.should raise_error(FloatDomainError) + -> { BigDecimal("NaN").add(BigDecimal("1"),0) }.should raise_error(FloatDomainError) BigDecimal.mode(BigDecimal::EXCEPTION_INFINITY, true) - lambda { BigDecimal("0").add(BigDecimal("Infinity"),0) }.should raise_error(FloatDomainError) + -> { BigDecimal("0").add(BigDecimal("Infinity"),0) }.should raise_error(FloatDomainError) BigDecimal.mode(BigDecimal::EXCEPTION_ZERODIVIDE, true) - lambda { BigDecimal("1").quo(BigDecimal("0")) }.should raise_error(FloatDomainError) + -> { BigDecimal("1").quo(BigDecimal("0")) }.should raise_error(FloatDomainError) BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, true) - lambda { BigDecimal("1E11111111111111111111") }.should raise_error(FloatDomainError) - lambda { (BigDecimal("1E1000000000000000000")**10) }.should raise_error(FloatDomainError) + -> { BigDecimal("1E11111111111111111111") }.should raise_error(FloatDomainError) + -> { (BigDecimal("1E1000000000000000000")**10) }.should raise_error(FloatDomainError) end end diff --git a/spec/ruby/library/bigdecimal/multiply_spec.rb b/spec/ruby/library/bigdecimal/multiply_spec.rb index 4e5a8d6681..a8ce1da32e 100644 --- a/spec/ruby/library/bigdecimal/multiply_spec.rb +++ b/spec/ruby/library/bigdecimal/multiply_spec.rb @@ -8,6 +8,7 @@ end describe "BigDecimal#*" do before :each do + @three = BigDecimal("3") @e3_minus = BigDecimal("3E-20001") @e3_plus = BigDecimal("3E20001") @e = BigDecimal("1.00000000000000000000123456789") @@ -31,4 +32,10 @@ describe "BigDecimal#*" do (@e3_minus * object).should == BigDecimal("9") end end + + describe "with Rational" do + it "produces a BigDecimal" do + (@three * Rational(500, 2)).should == BigDecimal("0.75e3") + end + end end diff --git a/spec/ruby/library/bigdecimal/remainder_spec.rb b/spec/ruby/library/bigdecimal/remainder_spec.rb index 8626064a2f..04233edece 100644 --- a/spec/ruby/library/bigdecimal/remainder_spec.rb +++ b/spec/ruby/library/bigdecimal/remainder_spec.rb @@ -84,7 +84,7 @@ describe "BigDecimal#remainder" do end it "raises TypeError if the argument cannot be coerced to BigDecimal" do - lambda { + -> { @one.remainder('2') }.should raise_error(TypeError) end diff --git a/spec/ruby/library/bigdecimal/round_spec.rb b/spec/ruby/library/bigdecimal/round_spec.rb index 467e2c5563..501a1a7342 100644 --- a/spec/ruby/library/bigdecimal/round_spec.rb +++ b/spec/ruby/library/bigdecimal/round_spec.rb @@ -217,18 +217,18 @@ describe "BigDecimal#round" do end it 'raise exception, if self is special value' do - lambda { BigDecimal('NaN').round }.should raise_error(FloatDomainError) - lambda { BigDecimal('Infinity').round }.should raise_error(FloatDomainError) - lambda { BigDecimal('-Infinity').round }.should raise_error(FloatDomainError) + -> { BigDecimal('NaN').round }.should raise_error(FloatDomainError) + -> { BigDecimal('Infinity').round }.should raise_error(FloatDomainError) + -> { BigDecimal('-Infinity').round }.should raise_error(FloatDomainError) end it 'do not raise exception, if self is special value and precision is given' do - lambda { BigDecimal('NaN').round(2) }.should_not raise_error(FloatDomainError) - lambda { BigDecimal('Infinity').round(2) }.should_not raise_error(FloatDomainError) - lambda { BigDecimal('-Infinity').round(2) }.should_not raise_error(FloatDomainError) + -> { BigDecimal('NaN').round(2) }.should_not raise_error(FloatDomainError) + -> { BigDecimal('Infinity').round(2) }.should_not raise_error(FloatDomainError) + -> { BigDecimal('-Infinity').round(2) }.should_not raise_error(FloatDomainError) end it "raise for a non-existent round mode" do - lambda { @p1_50.round(0, :nonsense) }.should raise_error(ArgumentError, "invalid rounding mode") + -> { @p1_50.round(0, :nonsense) }.should raise_error(ArgumentError, "invalid rounding mode") end end diff --git a/spec/ruby/library/bigdecimal/shared/modulo.rb b/spec/ruby/library/bigdecimal/shared/modulo.rb index d570b86d7a..67c0ecf2fc 100644 --- a/spec/ruby/library/bigdecimal/shared/modulo.rb +++ b/spec/ruby/library/bigdecimal/shared/modulo.rb @@ -108,7 +108,7 @@ describe :bigdecimal_modulo, shared: true do end it "raises TypeError if the argument cannot be coerced to BigDecimal" do - lambda { + -> { @one.send(@method, '2') }.should raise_error(TypeError) end @@ -118,8 +118,8 @@ describe :bigdecimal_modulo_zerodivisionerror, shared: true do it "raises ZeroDivisionError if other is zero" do bd5667 = BigDecimal("5667.19") - lambda { bd5667.send(@method, 0) }.should raise_error(ZeroDivisionError) - lambda { bd5667.send(@method, BigDecimal("0")) }.should raise_error(ZeroDivisionError) - lambda { @zero.send(@method, @zero) }.should raise_error(ZeroDivisionError) + -> { bd5667.send(@method, 0) }.should raise_error(ZeroDivisionError) + -> { bd5667.send(@method, BigDecimal("0")) }.should raise_error(ZeroDivisionError) + -> { @zero.send(@method, @zero) }.should raise_error(ZeroDivisionError) end end diff --git a/spec/ruby/library/bigdecimal/shared/to_int.rb b/spec/ruby/library/bigdecimal/shared/to_int.rb index 729a25f511..02f6092f23 100644 --- a/spec/ruby/library/bigdecimal/shared/to_int.rb +++ b/spec/ruby/library/bigdecimal/shared/to_int.rb @@ -2,8 +2,8 @@ require 'bigdecimal' describe :bigdecimal_to_int , shared: true do it "raises FloatDomainError if BigDecimal is infinity or NaN" do - lambda { BigDecimal("Infinity").send(@method) }.should raise_error(FloatDomainError) - lambda { BigDecimal("NaN").send(@method) }.should raise_error(FloatDomainError) + -> { BigDecimal("Infinity").send(@method) }.should raise_error(FloatDomainError) + -> { BigDecimal("NaN").send(@method) }.should raise_error(FloatDomainError) end it "returns Integer or Bignum otherwise" do diff --git a/spec/ruby/library/bigdecimal/sqrt_spec.rb b/spec/ruby/library/bigdecimal/sqrt_spec.rb index 75182fcbc8..d149003b9f 100644 --- a/spec/ruby/library/bigdecimal/sqrt_spec.rb +++ b/spec/ruby/library/bigdecimal/sqrt_spec.rb @@ -41,37 +41,37 @@ describe "BigDecimal#sqrt" do end it "raises ArgumentError when no argument is given" do - lambda { + -> { @one.sqrt }.should raise_error(ArgumentError) end it "raises ArgumentError if a negative number is given" do - lambda { + -> { @one.sqrt(-1) }.should raise_error(ArgumentError) end it "raises ArgumentError if 2 arguments are given" do - lambda { + -> { @one.sqrt(1, 1) }.should raise_error(ArgumentError) end it "raises TypeError if nil is given" do - lambda { + -> { @one.sqrt(nil) }.should raise_error(TypeError) end it "raises TypeError if a string is given" do - lambda { + -> { @one.sqrt("stuff") }.should raise_error(TypeError) end it "raises TypeError if a plain Object is given" do - lambda { + -> { @one.sqrt(Object.new) }.should raise_error(TypeError) end @@ -82,7 +82,7 @@ describe "BigDecimal#sqrt" do end it "raises FloatDomainError on negative values" do - lambda { + -> { BigDecimal('-1').sqrt(10) }.should raise_error(FloatDomainError) end @@ -92,13 +92,13 @@ describe "BigDecimal#sqrt" do end it "raises FloatDomainError for negative infinity" do - lambda { + -> { @infinity_minus.sqrt(1) }.should raise_error(FloatDomainError) end it "raises FloatDomainError for NaN" do - lambda { + -> { @nan.sqrt(1) }.should raise_error(FloatDomainError) end diff --git a/spec/ruby/library/bigdecimal/sub_spec.rb b/spec/ruby/library/bigdecimal/sub_spec.rb index f0068b12a9..29ec851193 100644 --- a/spec/ruby/library/bigdecimal/sub_spec.rb +++ b/spec/ruby/library/bigdecimal/sub_spec.rb @@ -7,6 +7,7 @@ describe "BigDecimal#sub" do @one = BigDecimal("1") @zero = BigDecimal("0") @two = BigDecimal("2") + @three = BigDecimal("3") @nan = BigDecimal("NaN") @infinity = BigDecimal("Infinity") @infinity_minus = BigDecimal("-Infinity") @@ -42,6 +43,12 @@ describe "BigDecimal#sub" do end end + describe "with Rational" do + it "produces a BigDecimal" do + (@three - Rational(500, 2)).should == BigDecimal('-0.247e3') + end + end + it "returns NaN if NaN is involved" do @one.sub(@nan, 1).nan?.should == true @nan.sub(@one, 1).nan?.should == true diff --git a/spec/ruby/library/bigdecimal/to_s_spec.rb b/spec/ruby/library/bigdecimal/to_s_spec.rb index c7ee6a01b0..b6154c680d 100644 --- a/spec/ruby/library/bigdecimal/to_s_spec.rb +++ b/spec/ruby/library/bigdecimal/to_s_spec.rb @@ -26,7 +26,7 @@ describe "BigDecimal#to_s" do end it "takes an optional argument" do - lambda {@bigdec.to_s("F")}.should_not raise_error() + -> {@bigdec.to_s("F")}.should_not raise_error() end it "starts with + if + is supplied and value is positive" do diff --git a/spec/ruby/library/bigdecimal/truncate_spec.rb b/spec/ruby/library/bigdecimal/truncate_spec.rb index 7edee771c9..d3a15f62c7 100644 --- a/spec/ruby/library/bigdecimal/truncate_spec.rb +++ b/spec/ruby/library/bigdecimal/truncate_spec.rb @@ -74,8 +74,8 @@ describe "BigDecimal#truncate" do end it "returns the same value if self is special value" do - lambda { @nan.truncate }.should raise_error(FloatDomainError) - lambda { @infinity.truncate }.should raise_error(FloatDomainError) - lambda { @infinity_negative.truncate }.should raise_error(FloatDomainError) + -> { @nan.truncate }.should raise_error(FloatDomainError) + -> { @infinity.truncate }.should raise_error(FloatDomainError) + -> { @infinity_negative.truncate }.should raise_error(FloatDomainError) end end diff --git a/spec/ruby/library/cgi/cookie/initialize_spec.rb b/spec/ruby/library/cgi/cookie/initialize_spec.rb index f41129a9cf..4b6e104b10 100644 --- a/spec/ruby/library/cgi/cookie/initialize_spec.rb +++ b/spec/ruby/library/cgi/cookie/initialize_spec.rb @@ -120,8 +120,8 @@ describe "CGI::Cookie#initialize when passed Hash" do end it "raises a ArgumentError when the passed Hash has no 'name' entry" do - lambda { @cookie.send(:initialize, {}) }.should raise_error(ArgumentError) - lambda { @cookie.send(:initialize, "value" => "test") }.should raise_error(ArgumentError) + -> { @cookie.send(:initialize, {}) }.should raise_error(ArgumentError) + -> { @cookie.send(:initialize, "value" => "test") }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/cgi/out_spec.rb b/spec/ruby/library/cgi/out_spec.rb index 84068cdd4f..bc09f5bcbb 100644 --- a/spec/ruby/library/cgi/out_spec.rb +++ b/spec/ruby/library/cgi/out_spec.rb @@ -46,6 +46,6 @@ describe "CGI#out when passed no block" do end it "raises a LocalJumpError" do - lambda { @cgi.out }.should raise_error(LocalJumpError) + -> { @cgi.out }.should raise_error(LocalJumpError) end end diff --git a/spec/ruby/library/complex/math/shared/acos.rb b/spec/ruby/library/complex/math/shared/acos.rb index 61be31571f..65637fa838 100644 --- a/spec/ruby/library/complex/math/shared/acos.rb +++ b/spec/ruby/library/complex/math/shared/acos.rb @@ -28,14 +28,14 @@ describe :complex_math_acos_bang, shared: true do end it "raises a TypeError when passed a Complex number" do - lambda { @object.send(:acos!, Complex(4, 5)) }.should raise_error(TypeError) + -> { @object.send(:acos!, Complex(4, 5)) }.should raise_error(TypeError) end it "raises an Errno::EDOM for numbers greater than 1.0" do - lambda { @object.send(:acos!, 1.0001) }.should raise_error(Errno::EDOM) + -> { @object.send(:acos!, 1.0001) }.should raise_error(Errno::EDOM) end it "raises an Errno::EDOM for numbers less than -1.0" do - lambda { @object.send(:acos!, -1.0001) }.should raise_error(Errno::EDOM) + -> { @object.send(:acos!, -1.0001) }.should raise_error(Errno::EDOM) end end diff --git a/spec/ruby/library/complex/math/shared/acosh.rb b/spec/ruby/library/complex/math/shared/acosh.rb index a2cd887f95..285b0b823f 100644 --- a/spec/ruby/library/complex/math/shared/acosh.rb +++ b/spec/ruby/library/complex/math/shared/acosh.rb @@ -26,12 +26,12 @@ describe :complex_math_acosh_bang, shared: true do end it "raises Errno::EDOM for numbers less than 1.0" do - lambda { @object.send(:acosh!, 1.0 - TOLERANCE) }.should raise_error(Errno::EDOM) - lambda { @object.send(:acosh!, 0) }.should raise_error(Errno::EDOM) - lambda { @object.send(:acosh!, -1.0) }.should raise_error(Errno::EDOM) + -> { @object.send(:acosh!, 1.0 - TOLERANCE) }.should raise_error(Errno::EDOM) + -> { @object.send(:acosh!, 0) }.should raise_error(Errno::EDOM) + -> { @object.send(:acosh!, -1.0) }.should raise_error(Errno::EDOM) end it "raises a TypeError when passed a Complex number" do - lambda { @object.send(:acosh!, Complex(4, 5)) }.should raise_error(TypeError) + -> { @object.send(:acosh!, Complex(4, 5)) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/complex/math/shared/asin.rb b/spec/ruby/library/complex/math/shared/asin.rb index 1705745210..91fed7aa06 100644 --- a/spec/ruby/library/complex/math/shared/asin.rb +++ b/spec/ruby/library/complex/math/shared/asin.rb @@ -34,14 +34,14 @@ describe :complex_math_asin_bang, shared: true do end it "raises an Errno::EDOM if the argument is greater than 1.0" do - lambda { @object.send(:asin!, 1.0001) }.should raise_error( Errno::EDOM) + -> { @object.send(:asin!, 1.0001) }.should raise_error( Errno::EDOM) end it "raises an Errno::EDOM if the argument is less than -1.0" do - lambda { @object.send(:asin!, -1.0001) }.should raise_error( Errno::EDOM) + -> { @object.send(:asin!, -1.0001) }.should raise_error( Errno::EDOM) end it "raises a TypeError when passed a Complex number" do - lambda { @object.send(:asin!, Complex(4, 5)) }.should raise_error(TypeError) + -> { @object.send(:asin!, Complex(4, 5)) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/complex/math/shared/asinh.rb b/spec/ruby/library/complex/math/shared/asinh.rb index b4256e7475..b4ddd3a22e 100644 --- a/spec/ruby/library/complex/math/shared/asinh.rb +++ b/spec/ruby/library/complex/math/shared/asinh.rb @@ -27,6 +27,6 @@ describe :complex_math_asinh_bang, shared: true do end it "raises a TypeError when passed a Complex number" do - lambda { @object.send(:asinh!, Complex(4, 5)) }.should raise_error(TypeError) + -> { @object.send(:asinh!, Complex(4, 5)) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/complex/math/shared/atan.rb b/spec/ruby/library/complex/math/shared/atan.rb index 46c1897407..63a496e841 100644 --- a/spec/ruby/library/complex/math/shared/atan.rb +++ b/spec/ruby/library/complex/math/shared/atan.rb @@ -27,6 +27,6 @@ describe :complex_math_atan_bang, shared: true do end it "raises a TypeError when passed a Complex number" do - lambda { @object.send(:atan!, Complex(4, 5)) }.should raise_error(TypeError) + -> { @object.send(:atan!, Complex(4, 5)) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/complex/math/shared/atan2.rb b/spec/ruby/library/complex/math/shared/atan2.rb index 3305d695c5..6d89423924 100644 --- a/spec/ruby/library/complex/math/shared/atan2.rb +++ b/spec/ruby/library/complex/math/shared/atan2.rb @@ -27,8 +27,8 @@ describe :complex_math_atan2_bang, shared: true do end it "raises a TypeError when passed a Complex number" do - lambda { @object.send(:atan2!, Complex(4, 5), Complex(4, 5)) }.should raise_error(TypeError) - lambda { @object.send(:atan2!, 4, Complex(4, 5)) }.should raise_error(TypeError) - lambda { @object.send(:atan2!, Complex(4, 5), 5) }.should raise_error(TypeError) + -> { @object.send(:atan2!, Complex(4, 5), Complex(4, 5)) }.should raise_error(TypeError) + -> { @object.send(:atan2!, 4, Complex(4, 5)) }.should raise_error(TypeError) + -> { @object.send(:atan2!, Complex(4, 5), 5) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/complex/math/shared/atanh.rb b/spec/ruby/library/complex/math/shared/atanh.rb index ebd4d7c223..ae80e61bec 100644 --- a/spec/ruby/library/complex/math/shared/atanh.rb +++ b/spec/ruby/library/complex/math/shared/atanh.rb @@ -25,6 +25,6 @@ end describe :complex_math_atanh_no_complex, shared: true do it "raises a TypeError when passed a Complex number" do - lambda { @object.send(:atanh!, Complex(4, 5)) }.should raise_error(TypeError) + -> { @object.send(:atanh!, Complex(4, 5)) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/complex/math/shared/cos.rb b/spec/ruby/library/complex/math/shared/cos.rb index ddd8512231..31cb5ab1e5 100644 --- a/spec/ruby/library/complex/math/shared/cos.rb +++ b/spec/ruby/library/complex/math/shared/cos.rb @@ -25,6 +25,6 @@ describe :complex_math_cos_bang, shared: true do end it "raises a TypeError when passed a Complex number" do - lambda { @object.send(:cos!, Complex(3, 4)) }.should raise_error(TypeError) + -> { @object.send(:cos!, Complex(3, 4)) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/complex/math/shared/cosh.rb b/spec/ruby/library/complex/math/shared/cosh.rb index a56a655cd5..7cf561c985 100644 --- a/spec/ruby/library/complex/math/shared/cosh.rb +++ b/spec/ruby/library/complex/math/shared/cosh.rb @@ -23,6 +23,6 @@ describe :complex_math_cosh_bang, shared: true do end it "raises a TypeError when passed a Complex number" do - lambda { @object.send(:cosh!, Complex(4, 5)) }.should raise_error(TypeError) + -> { @object.send(:cosh!, Complex(4, 5)) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/complex/math/shared/exp.rb b/spec/ruby/library/complex/math/shared/exp.rb index 91ab5739be..6715ac63d3 100644 --- a/spec/ruby/library/complex/math/shared/exp.rb +++ b/spec/ruby/library/complex/math/shared/exp.rb @@ -23,6 +23,6 @@ describe :complex_math_exp_bang, shared: true do end it "raises a TypeError when passed a Complex number" do - lambda { @object.send(:exp!, Complex(1, 3)) }.should raise_error(TypeError) + -> { @object.send(:exp!, Complex(1, 3)) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/complex/math/shared/log.rb b/spec/ruby/library/complex/math/shared/log.rb index f3aad0d66a..4b23e8c5f2 100644 --- a/spec/ruby/library/complex/math/shared/log.rb +++ b/spec/ruby/library/complex/math/shared/log.rb @@ -30,10 +30,10 @@ describe :complex_math_log_bang, shared: true do end it "raises an Errno::EDOM if the argument is less than 0" do - lambda { @object.send(:log!, -10) }.should raise_error(Errno::EDOM) + -> { @object.send(:log!, -10) }.should raise_error(Errno::EDOM) end it "raises a TypeError when passed a Complex number" do - lambda { @object.send(:log!, Complex(4, 5)) }.should raise_error(TypeError) + -> { @object.send(:log!, Complex(4, 5)) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/complex/math/shared/log10.rb b/spec/ruby/library/complex/math/shared/log10.rb index a2cf5344bf..f49934d958 100644 --- a/spec/ruby/library/complex/math/shared/log10.rb +++ b/spec/ruby/library/complex/math/shared/log10.rb @@ -32,10 +32,10 @@ describe :complex_math_log10_bang, shared: true do end it "raises an Errno::EDOM when the passed argument is negative" do - lambda { @object.send(:log10!, -10) }.should raise_error(Errno::EDOM) + -> { @object.send(:log10!, -10) }.should raise_error(Errno::EDOM) end it "raises a TypeError when passed a Complex number" do - lambda { @object.send(:log10!, Complex(4, 5)) }.should raise_error(TypeError) + -> { @object.send(:log10!, Complex(4, 5)) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/complex/math/shared/sin.rb b/spec/ruby/library/complex/math/shared/sin.rb index 418ba5d810..1cb1b29cda 100644 --- a/spec/ruby/library/complex/math/shared/sin.rb +++ b/spec/ruby/library/complex/math/shared/sin.rb @@ -25,6 +25,6 @@ describe :complex_math_sin_bang, shared: true do end it "raises a TypeError when passed a Complex number" do - lambda { @object.send(:sin!, Complex(4, 5)) }.should raise_error(TypeError) + -> { @object.send(:sin!, Complex(4, 5)) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/complex/math/shared/sinh.rb b/spec/ruby/library/complex/math/shared/sinh.rb index bd85bd0799..de80a376da 100644 --- a/spec/ruby/library/complex/math/shared/sinh.rb +++ b/spec/ruby/library/complex/math/shared/sinh.rb @@ -23,6 +23,6 @@ describe :complex_math_sinh_bang, shared: true do end it "raises a TypeError when passed a Complex number" do - lambda { @object.send(:sinh!, Complex(4, 5)) }.should raise_error(TypeError) + -> { @object.send(:sinh!, Complex(4, 5)) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/complex/math/shared/sqrt.rb b/spec/ruby/library/complex/math/shared/sqrt.rb index b6a289c3f9..23b1ba48ff 100644 --- a/spec/ruby/library/complex/math/shared/sqrt.rb +++ b/spec/ruby/library/complex/math/shared/sqrt.rb @@ -24,11 +24,11 @@ describe :complex_math_sqrt_bang, shared: true do end it "raises Errno::EDOM when the passed argument is negative" do - lambda { @object.send(:sqrt!, -4) }.should raise_error(Errno::EDOM) - lambda { @object.send(:sqrt!, -19.36) }.should raise_error(Errno::EDOM) + -> { @object.send(:sqrt!, -4) }.should raise_error(Errno::EDOM) + -> { @object.send(:sqrt!, -19.36) }.should raise_error(Errno::EDOM) end it "raises a TypeError when passed a Complex number" do - lambda { @object.send(:sqrt!, Complex(4, 5)) }.should raise_error(TypeError) + -> { @object.send(:sqrt!, Complex(4, 5)) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/complex/math/shared/tan.rb b/spec/ruby/library/complex/math/shared/tan.rb index df7a6ff19b..9022c84fc9 100644 --- a/spec/ruby/library/complex/math/shared/tan.rb +++ b/spec/ruby/library/complex/math/shared/tan.rb @@ -23,6 +23,6 @@ describe :complex_math_tan_bang, shared: true do end it "raises a TypeError when passed a Complex number" do - lambda { @object.send(:tan!, Complex(4, 5)) }.should raise_error(TypeError) + -> { @object.send(:tan!, Complex(4, 5)) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/complex/math/shared/tanh.rb b/spec/ruby/library/complex/math/shared/tanh.rb index 7bf07f9a3f..f2c9a5abb1 100644 --- a/spec/ruby/library/complex/math/shared/tanh.rb +++ b/spec/ruby/library/complex/math/shared/tanh.rb @@ -27,6 +27,6 @@ describe :complex_math_tanh_bang, shared: true do end it "raises a TypeError when passed a Complex number" do - lambda { @object.send(:tanh!, Complex(4, 5)) }.should raise_error(TypeError) + -> { @object.send(:tanh!, Complex(4, 5)) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/date/add_month_spec.rb b/spec/ruby/library/date/add_month_spec.rb index 32e9de4d70..40833f6487 100644 --- a/spec/ruby/library/date/add_month_spec.rb +++ b/spec/ruby/library/date/add_month_spec.rb @@ -21,18 +21,18 @@ describe "Date#>>" do end it "raise a TypeError when passed a Symbol" do - lambda { Date.civil(2007,2,27) >> :hello }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) >> :hello }.should raise_error(TypeError) end it "raise a TypeError when passed a String" do - lambda { Date.civil(2007,2,27) >> "hello" }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) >> "hello" }.should raise_error(TypeError) end it "raise a TypeError when passed a Date" do - lambda { Date.civil(2007,2,27) >> Date.new }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) >> Date.new }.should raise_error(TypeError) end it "raise a TypeError when passed an Object" do - lambda { Date.civil(2007,2,27) >> Object.new }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) >> Object.new }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/date/add_spec.rb b/spec/ruby/library/date/add_spec.rb index edcff4c55b..2b9cc62023 100644 --- a/spec/ruby/library/date/add_spec.rb +++ b/spec/ruby/library/date/add_spec.rb @@ -13,18 +13,18 @@ describe "Date#+" do end it "raises a TypeError when passed a Symbol" do - lambda { Date.civil(2007,2,27) + :hello }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) + :hello }.should raise_error(TypeError) end it "raises a TypeError when passed a String" do - lambda { Date.civil(2007,2,27) + "hello" }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) + "hello" }.should raise_error(TypeError) end it "raises a TypeError when passed a Date" do - lambda { Date.civil(2007,2,27) + Date.new }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) + Date.new }.should raise_error(TypeError) end it "raises a TypeError when passed an Object" do - lambda { Date.civil(2007,2,27) + Object.new }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) + Object.new }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/date/constants_spec.rb b/spec/ruby/library/date/constants_spec.rb index dd7803052f..fc1dba4999 100644 --- a/spec/ruby/library/date/constants_spec.rb +++ b/spec/ruby/library/date/constants_spec.rb @@ -34,11 +34,11 @@ describe "Date constants" do it "freezes MONTHNAMES, DAYNAMES, ABBR_MONTHNAMES, ABBR_DAYSNAMES" do [Date::MONTHNAMES, Date::DAYNAMES, Date::ABBR_MONTHNAMES, Date::ABBR_DAYNAMES].each do |ary| - lambda { + -> { ary << "Unknown" }.should raise_error(frozen_error_class, /frozen/) ary.compact.each do |name| - lambda { + -> { name << "modified" }.should raise_error(frozen_error_class, /frozen/) end diff --git a/spec/ruby/library/date/iso8601_spec.rb b/spec/ruby/library/date/iso8601_spec.rb index 41f055e648..21b0a4cedd 100644 --- a/spec/ruby/library/date/iso8601_spec.rb +++ b/spec/ruby/library/date/iso8601_spec.rb @@ -28,10 +28,10 @@ describe "Date.iso8601" do end it "raises an ArgumentError when passed a Symbol without a valid Date" do - lambda { Date.iso8601(:test) }.should raise_error(ArgumentError) + -> { Date.iso8601(:test) }.should raise_error(ArgumentError) end it "raises a TypeError when passed an Object" do - lambda { Date.iso8601(Object.new) }.should raise_error(TypeError) + -> { Date.iso8601(Object.new) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/date/minus_month_spec.rb b/spec/ruby/library/date/minus_month_spec.rb index 563da073f0..470c4d8a76 100644 --- a/spec/ruby/library/date/minus_month_spec.rb +++ b/spec/ruby/library/date/minus_month_spec.rb @@ -14,10 +14,10 @@ describe "Date#<<" do end it "raises an error on non numeric parameters" do - lambda { Date.civil(2007,2,27) << :hello }.should raise_error(TypeError) - lambda { Date.civil(2007,2,27) << "hello" }.should raise_error(TypeError) - lambda { Date.civil(2007,2,27) << Date.new }.should raise_error(TypeError) - lambda { Date.civil(2007,2,27) << Object.new }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) << :hello }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) << "hello" }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) << Date.new }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) << Object.new }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/date/minus_spec.rb b/spec/ruby/library/date/minus_spec.rb index 4cf6129f02..5a2a29e04a 100644 --- a/spec/ruby/library/date/minus_spec.rb +++ b/spec/ruby/library/date/minus_spec.rb @@ -22,9 +22,9 @@ describe "Date#-" do end it "raises an error for non Numeric arguments" do - lambda { Date.civil(2007,2,27) - :hello }.should raise_error(TypeError) - lambda { Date.civil(2007,2,27) - "hello" }.should raise_error(TypeError) - lambda { Date.civil(2007,2,27) - Object.new }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) - :hello }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) - "hello" }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) - Object.new }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/date/parse_spec.rb b/spec/ruby/library/date/parse_spec.rb index 09e072ba3e..379847a6fd 100644 --- a/spec/ruby/library/date/parse_spec.rb +++ b/spec/ruby/library/date/parse_spec.rb @@ -23,7 +23,7 @@ describe "Date#parse" do # Specs using numbers it "throws an argument error for a single digit" do - lambda{ Date.parse("1") }.should raise_error(ArgumentError) + ->{ Date.parse("1") }.should raise_error(ArgumentError) end it "parses DD as month day number" do @@ -66,8 +66,8 @@ describe "Date#parse" do end it "raises a TypeError trying to parse non-String-like object" do - lambda { Date.parse(1) }.should raise_error(TypeError) - lambda { Date.parse(:invalid) }.should raise_error(TypeError) + -> { Date.parse(1) }.should raise_error(TypeError) + -> { Date.parse(:invalid) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/date/plus_spec.rb b/spec/ruby/library/date/plus_spec.rb index ce5e074ed7..0cb99fd4ca 100644 --- a/spec/ruby/library/date/plus_spec.rb +++ b/spec/ruby/library/date/plus_spec.rb @@ -15,6 +15,6 @@ describe "Date#+" do end it "raises TypeError if argument is not Numeric" do - lambda { Date.today + Date.today }.should raise_error(TypeError) + -> { Date.today + Date.today }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/date/shared/civil.rb b/spec/ruby/library/date/shared/civil.rb index 47dbed49fc..4c8ba23622 100644 --- a/spec/ruby/library/date/shared/civil.rb +++ b/spec/ruby/library/date/shared/civil.rb @@ -36,14 +36,14 @@ describe :date_civil, shared: true do end it "doesn't create dates for invalid arguments" do - lambda { Date.send(@method, 2000, 13, 31) }.should raise_error(ArgumentError) - lambda { Date.send(@method, 2000, 12, 32) }.should raise_error(ArgumentError) - lambda { Date.send(@method, 2000, 2, 30) }.should raise_error(ArgumentError) - lambda { Date.send(@method, 1900, 2, 29) }.should raise_error(ArgumentError) - lambda { Date.send(@method, 2000, 2, 29) }.should_not raise_error(ArgumentError) - - lambda { Date.send(@method, 1582, 10, 14) }.should raise_error(ArgumentError) - lambda { Date.send(@method, 1582, 10, 15) }.should_not raise_error(ArgumentError) + -> { Date.send(@method, 2000, 13, 31) }.should raise_error(ArgumentError) + -> { Date.send(@method, 2000, 12, 32) }.should raise_error(ArgumentError) + -> { Date.send(@method, 2000, 2, 30) }.should raise_error(ArgumentError) + -> { Date.send(@method, 1900, 2, 29) }.should raise_error(ArgumentError) + -> { Date.send(@method, 2000, 2, 29) }.should_not raise_error(ArgumentError) + + -> { Date.send(@method, 1582, 10, 14) }.should raise_error(ArgumentError) + -> { Date.send(@method, 1582, 10, 15) }.should_not raise_error(ArgumentError) end diff --git a/spec/ruby/library/date/shared/commercial.rb b/spec/ruby/library/date/shared/commercial.rb index 354a5d5cd0..39c9af47b6 100644 --- a/spec/ruby/library/date/shared/commercial.rb +++ b/spec/ruby/library/date/shared/commercial.rb @@ -25,15 +25,15 @@ describe :date_commercial, shared: true do end it "creates only Date objects for valid weeks" do - lambda { Date.send(@method, 2004, 53, 1) }.should_not raise_error(ArgumentError) - lambda { Date.send(@method, 2004, 53, 0) }.should raise_error(ArgumentError) - lambda { Date.send(@method, 2004, 53, 8) }.should raise_error(ArgumentError) - lambda { Date.send(@method, 2004, 54, 1) }.should raise_error(ArgumentError) - lambda { Date.send(@method, 2004, 0, 1) }.should raise_error(ArgumentError) + -> { Date.send(@method, 2004, 53, 1) }.should_not raise_error(ArgumentError) + -> { Date.send(@method, 2004, 53, 0) }.should raise_error(ArgumentError) + -> { Date.send(@method, 2004, 53, 8) }.should raise_error(ArgumentError) + -> { Date.send(@method, 2004, 54, 1) }.should raise_error(ArgumentError) + -> { Date.send(@method, 2004, 0, 1) }.should raise_error(ArgumentError) - lambda { Date.send(@method, 2003, 52, 1) }.should_not raise_error(ArgumentError) - lambda { Date.send(@method, 2003, 53, 1) }.should raise_error(ArgumentError) - lambda { Date.send(@method, 2003, 52, 0) }.should raise_error(ArgumentError) - lambda { Date.send(@method, 2003, 52, 8) }.should raise_error(ArgumentError) + -> { Date.send(@method, 2003, 52, 1) }.should_not raise_error(ArgumentError) + -> { Date.send(@method, 2003, 53, 1) }.should raise_error(ArgumentError) + -> { Date.send(@method, 2003, 52, 0) }.should raise_error(ArgumentError) + -> { Date.send(@method, 2003, 52, 8) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/date/strftime_spec.rb b/spec/ruby/library/date/strftime_spec.rb index 973d4668f8..9d298e42e6 100644 --- a/spec/ruby/library/date/strftime_spec.rb +++ b/spec/ruby/library/date/strftime_spec.rb @@ -3,7 +3,7 @@ require_relative '../../shared/time/strftime_for_date' describe "Date#strftime" do before :all do - @new_date = lambda { |y,m,d| Date.civil(y,m,d) } + @new_date = -> y, m, d { Date.civil(y,m,d) } @date = Date.civil(2000, 4, 9) end diff --git a/spec/ruby/library/datetime/hour_spec.rb b/spec/ruby/library/datetime/hour_spec.rb index f019b60c74..8efd5f92f0 100644 --- a/spec/ruby/library/datetime/hour_spec.rb +++ b/spec/ruby/library/datetime/hour_spec.rb @@ -15,27 +15,27 @@ describe "DateTime#hour" do end it "raises an error for Rational" do - lambda { new_datetime(hour: 1 + Rational(1,2)) }.should raise_error(ArgumentError) + -> { new_datetime(hour: 1 + Rational(1,2)) }.should raise_error(ArgumentError) end it "raises an error for Float" do - lambda { new_datetime(hour: 1.5).hour }.should raise_error(ArgumentError) + -> { new_datetime(hour: 1.5).hour }.should raise_error(ArgumentError) end it "raises an error for Rational" do - lambda { new_datetime(day: 1 + Rational(1,2)) }.should raise_error(ArgumentError) + -> { new_datetime(day: 1 + Rational(1,2)) }.should raise_error(ArgumentError) end it "raises an error, when the hour is smaller than -24" do - lambda { new_datetime(hour: -25) }.should raise_error(ArgumentError) + -> { new_datetime(hour: -25) }.should raise_error(ArgumentError) end it "raises an error, when the hour is larger than 24" do - lambda { new_datetime(hour: 25) }.should raise_error(ArgumentError) + -> { new_datetime(hour: 25) }.should raise_error(ArgumentError) end it "raises an error for hour fractions smaller than -24" do - lambda { new_datetime(hour: -24 - Rational(1,2)) }.should( + -> { new_datetime(hour: -24 - Rational(1,2)) }.should( raise_error(ArgumentError)) end diff --git a/spec/ruby/library/datetime/new_spec.rb b/spec/ruby/library/datetime/new_spec.rb index 85fbe7578b..6a4dced384 100644 --- a/spec/ruby/library/datetime/new_spec.rb +++ b/spec/ruby/library/datetime/new_spec.rb @@ -47,6 +47,6 @@ describe "DateTime.new" do end it "raises an error on invalid arguments" do - lambda { new_datetime(minute: 999) }.should raise_error(ArgumentError) + -> { new_datetime(minute: 999) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/datetime/parse_spec.rb b/spec/ruby/library/datetime/parse_spec.rb index e5441bd9dc..e9bf4e2ed1 100644 --- a/spec/ruby/library/datetime/parse_spec.rb +++ b/spec/ruby/library/datetime/parse_spec.rb @@ -20,7 +20,7 @@ describe "DateTime.parse" do # Specs using numbers it "throws an argument error for a single digit" do - lambda{ DateTime.parse("1") }.should raise_error(ArgumentError) + ->{ DateTime.parse("1") }.should raise_error(ArgumentError) end it "parses DD as month day number" do @@ -54,23 +54,23 @@ describe "DateTime.parse" do end it "throws an argument error for invalid month values" do - lambda{DateTime.parse("2012-13-08T15:43:59")}.should raise_error(ArgumentError) + ->{DateTime.parse("2012-13-08T15:43:59")}.should raise_error(ArgumentError) end it "throws an argument error for invalid day values" do - lambda{DateTime.parse("2012-12-32T15:43:59")}.should raise_error(ArgumentError) + ->{DateTime.parse("2012-12-32T15:43:59")}.should raise_error(ArgumentError) end it "throws an argument error for invalid hour values" do - lambda{DateTime.parse("2012-12-31T25:43:59")}.should raise_error(ArgumentError) + ->{DateTime.parse("2012-12-31T25:43:59")}.should raise_error(ArgumentError) end it "throws an argument error for invalid minute values" do - lambda{DateTime.parse("2012-12-31T25:43:59")}.should raise_error(ArgumentError) + ->{DateTime.parse("2012-12-31T25:43:59")}.should raise_error(ArgumentError) end it "throws an argument error for invalid second values" do - lambda{DateTime.parse("2012-11-08T15:43:61")}.should raise_error(ArgumentError) + ->{DateTime.parse("2012-11-08T15:43:61")}.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/datetime/shared/min.rb b/spec/ruby/library/datetime/shared/min.rb index e69d86ab02..a35b839281 100644 --- a/spec/ruby/library/datetime/shared/min.rb +++ b/spec/ruby/library/datetime/shared/min.rb @@ -14,27 +14,27 @@ describe :datetime_min, shared: true do end it "raises an error for Rational" do - lambda { new_datetime minute: 5 + Rational(1,2) }.should raise_error(ArgumentError) + -> { new_datetime minute: 5 + Rational(1,2) }.should raise_error(ArgumentError) end it "raises an error for Float" do - lambda { new_datetime minute: 5.5 }.should raise_error(ArgumentError) + -> { new_datetime minute: 5.5 }.should raise_error(ArgumentError) end it "raises an error for Rational" do - lambda { new_datetime(hour: 2 + Rational(1,2)) }.should raise_error(ArgumentError) + -> { new_datetime(hour: 2 + Rational(1,2)) }.should raise_error(ArgumentError) end it "raises an error, when the minute is smaller than -60" do - lambda { new_datetime(minute: -61) }.should raise_error(ArgumentError) + -> { new_datetime(minute: -61) }.should raise_error(ArgumentError) end it "raises an error, when the minute is greater or equal than 60" do - lambda { new_datetime(minute: 60) }.should raise_error(ArgumentError) + -> { new_datetime(minute: 60) }.should raise_error(ArgumentError) end it "raises an error for minute fractions smaller than -60" do - lambda { new_datetime(minute: -60 - Rational(1,2))}.should( + -> { new_datetime(minute: -60 - Rational(1,2))}.should( raise_error(ArgumentError)) end end diff --git a/spec/ruby/library/datetime/shared/sec.rb b/spec/ruby/library/datetime/shared/sec.rb index 68e8af8e40..60009213aa 100644 --- a/spec/ruby/library/datetime/shared/sec.rb +++ b/spec/ruby/library/datetime/shared/sec.rb @@ -23,19 +23,19 @@ describe :datetime_sec, shared: true do end it "raises an error when minute is given as a rational" do - lambda { new_datetime(minute: 5 + Rational(1,2)) }.should raise_error(ArgumentError) + -> { new_datetime(minute: 5 + Rational(1,2)) }.should raise_error(ArgumentError) end it "raises an error, when the second is smaller than -60" do - lambda { new_datetime(second: -61) }.should raise_error(ArgumentError) + -> { new_datetime(second: -61) }.should raise_error(ArgumentError) end it "raises an error, when the second is greater or equal than 60" do - lambda { new_datetime(second: 60) }.should raise_error(ArgumentError) + -> { new_datetime(second: 60) }.should raise_error(ArgumentError) end it "raises an error for second fractions smaller than -60" do - lambda { new_datetime(second: -60 - Rational(1,2))}.should( + -> { new_datetime(second: -60 - Rational(1,2))}.should( raise_error(ArgumentError)) end diff --git a/spec/ruby/library/datetime/strftime_spec.rb b/spec/ruby/library/datetime/strftime_spec.rb index f95b52fffb..1c925f92eb 100644 --- a/spec/ruby/library/datetime/strftime_spec.rb +++ b/spec/ruby/library/datetime/strftime_spec.rb @@ -4,13 +4,13 @@ require_relative '../../shared/time/strftime_for_time' describe "DateTime#strftime" do before :all do - @new_date = lambda { |y,m,d| DateTime.civil(y,m,d) } - @new_time = lambda { |*args| DateTime.civil(*args) } - @new_time_in_zone = lambda { |zone,offset,*args| + @new_date = -> y, m, d { DateTime.civil(y,m,d) } + @new_time = -> *args { DateTime.civil(*args) } + @new_time_in_zone = -> zone, offset, *args { y, m, d, h, min, s = args DateTime.new(y, m||1, d||1, h||0, min||0, s||0, Rational(offset, 24)) } - @new_time_with_offset = lambda { |y,m,d,h,min,s,offset| + @new_time_with_offset = -> y, m, d, h, min, s, offset { DateTime.new(y,m,d,h,min,s, Rational(offset, 86_400)) } diff --git a/spec/ruby/library/delegate/delegate_class/instance_method_spec.rb b/spec/ruby/library/delegate/delegate_class/instance_method_spec.rb index 7e50dd81d8..16bf8d734c 100644 --- a/spec/ruby/library/delegate/delegate_class/instance_method_spec.rb +++ b/spec/ruby/library/delegate/delegate_class/instance_method_spec.rb @@ -20,7 +20,7 @@ describe "DelegateClass.instance_method" do end it "raises a NameError for a private instance methods of the delegated class" do - lambda { + -> { @klass.instance_method(:priv) }.should raise_error(NameError) end @@ -44,7 +44,7 @@ describe "DelegateClass.instance_method" do end it "raises a NameError for an invalid method name" do - lambda { + -> { @klass.instance_method(:invalid_and_silly_method_name) }.should raise_error(NameError) end diff --git a/spec/ruby/library/delegate/delegator/frozen_spec.rb b/spec/ruby/library/delegate/delegator/frozen_spec.rb index bc91259b08..b3145c54b1 100644 --- a/spec/ruby/library/delegate/delegator/frozen_spec.rb +++ b/spec/ruby/library/delegate/delegator/frozen_spec.rb @@ -18,7 +18,7 @@ describe "Delegator when frozen" do end it "is not writable" do - lambda{ @delegate[0] += 2 }.should raise_error( RuntimeError ) + ->{ @delegate[0] += 2 }.should raise_error( RuntimeError ) end it "creates a frozen clone" do @@ -30,7 +30,7 @@ describe "Delegator when frozen" do end it "causes mutative calls to raise RuntimeError" do - lambda{ @delegate.__setobj__("hola!") }.should raise_error( RuntimeError ) + ->{ @delegate.__setobj__("hola!") }.should raise_error( RuntimeError ) end it "returns false if only the delegated object is frozen" do diff --git a/spec/ruby/library/delegate/delegator/method_spec.rb b/spec/ruby/library/delegate/delegator/method_spec.rb index 7b66c28125..81c8eea710 100644 --- a/spec/ruby/library/delegate/delegator/method_spec.rb +++ b/spec/ruby/library/delegate/delegator/method_spec.rb @@ -14,7 +14,7 @@ describe "Delegator#method" do end it "raises a NameError for protected methods of the delegate object" do - lambda { + -> { -> { @delegate.method(:prot) }.should complain(/delegator does not forward private method #prot/) @@ -22,7 +22,7 @@ describe "Delegator#method" do end it "raises a NameError for a private methods of the delegate object" do - lambda { + -> { -> { @delegate.method(:priv) }.should complain(/delegator does not forward private method #priv/) @@ -48,7 +48,7 @@ describe "Delegator#method" do end it "raises a NameError for an invalid method name" do - lambda { + -> { @delegate.method(:invalid_and_silly_method_name) }.should raise_error(NameError) end @@ -62,7 +62,7 @@ describe "Delegator#method" do it "raises a NameError if method is no longer valid because object has changed" do m = @delegate.method(:pub) @delegate.__setobj__([1,2,3]) - lambda { + -> { m.call }.should raise_error(NameError) end diff --git a/spec/ruby/library/delegate/delegator/send_spec.rb b/spec/ruby/library/delegate/delegator/send_spec.rb index b14e6996d1..3022c2ce91 100644 --- a/spec/ruby/library/delegate/delegator/send_spec.rb +++ b/spec/ruby/library/delegate/delegator/send_spec.rb @@ -12,15 +12,15 @@ describe "SimpleDelegator.new" do end it "forwards protected method calls" do - lambda{ @delegate.prot }.should raise_error( NoMethodError ) + ->{ @delegate.prot }.should raise_error( NoMethodError ) end it "doesn't forward private method calls" do - lambda{ @delegate.priv }.should raise_error( NoMethodError ) + ->{ @delegate.priv }.should raise_error( NoMethodError ) end it "doesn't forward private method calls even via send or __send__" do - lambda{ @delegate.send(:priv, 42) }.should raise_error( NoMethodError ) - lambda{ @delegate.__send__(:priv, 42) }.should raise_error( NoMethodError ) + ->{ @delegate.send(:priv, 42) }.should raise_error( NoMethodError ) + ->{ @delegate.__send__(:priv, 42) }.should raise_error( NoMethodError ) end end diff --git a/spec/ruby/library/delegate/delegator/untaint_spec.rb b/spec/ruby/library/delegate/delegator/untaint_spec.rb index 4fa4509b53..ddcf854a43 100644 --- a/spec/ruby/library/delegate/delegator/untaint_spec.rb +++ b/spec/ruby/library/delegate/delegator/untaint_spec.rb @@ -3,7 +3,7 @@ require_relative '../fixtures/classes' describe "Delegator#untaint" do before :each do - @delegate = lambda { DelegateSpecs::Delegator.new("") }.call + @delegate = -> { DelegateSpecs::Delegator.new("") }.call end it "returns self" do diff --git a/spec/ruby/library/digest/bubblebabble_spec.rb b/spec/ruby/library/digest/bubblebabble_spec.rb index 7e06a974a3..7097553466 100644 --- a/spec/ruby/library/digest/bubblebabble_spec.rb +++ b/spec/ruby/library/digest/bubblebabble_spec.rb @@ -20,10 +20,10 @@ describe "Digest.bubblebabble" do end it "raises a TypeError when passed nil" do - lambda { Digest.bubblebabble(nil) }.should raise_error(TypeError) + -> { Digest.bubblebabble(nil) }.should raise_error(TypeError) end it "raises a TypeError when passed a Fixnum" do - lambda { Digest.bubblebabble(9001) }.should raise_error(TypeError) + -> { Digest.bubblebabble(9001) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/digest/hexencode_spec.rb b/spec/ruby/library/digest/hexencode_spec.rb index 717590dd14..fcbbf4846a 100644 --- a/spec/ruby/library/digest/hexencode_spec.rb +++ b/spec/ruby/library/digest/hexencode_spec.rb @@ -22,10 +22,10 @@ describe "Digest.hexencode" do end it "raises a TypeError when passed nil" do - lambda { Digest.hexencode(nil) }.should raise_error(TypeError) + -> { Digest.hexencode(nil) }.should raise_error(TypeError) end it "raises a TypeError when passed a Fixnum" do - lambda { Digest.hexencode(9001) }.should raise_error(TypeError) + -> { Digest.hexencode(9001) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/digest/md5/file_spec.rb b/spec/ruby/library/digest/md5/file_spec.rb index 2684f50373..0c8d12cbc9 100644 --- a/spec/ruby/library/digest/md5/file_spec.rb +++ b/spec/ruby/library/digest/md5/file_spec.rb @@ -34,10 +34,10 @@ describe "Digest::MD5.file" do it_behaves_like :file_read_directory, :file, Digest::MD5 it "raises a Errno::ENOENT when passed a path that does not exist" do - lambda { Digest::MD5.file("") }.should raise_error(Errno::ENOENT) + -> { Digest::MD5.file("") }.should raise_error(Errno::ENOENT) end it "raises a TypeError when passed nil" do - lambda { Digest::MD5.file(nil) }.should raise_error(TypeError) + -> { Digest::MD5.file(nil) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/digest/sha1/file_spec.rb b/spec/ruby/library/digest/sha1/file_spec.rb index 1ac4e1f756..9c15f5b02f 100644 --- a/spec/ruby/library/digest/sha1/file_spec.rb +++ b/spec/ruby/library/digest/sha1/file_spec.rb @@ -34,10 +34,10 @@ describe "Digest::SHA1.file" do it_behaves_like :file_read_directory, :file, Digest::SHA1 it "raises a Errno::ENOENT when passed a path that does not exist" do - lambda { Digest::SHA1.file("") }.should raise_error(Errno::ENOENT) + -> { Digest::SHA1.file("") }.should raise_error(Errno::ENOENT) end it "raises a TypeError when passed nil" do - lambda { Digest::SHA1.file(nil) }.should raise_error(TypeError) + -> { Digest::SHA1.file(nil) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/digest/sha256/file_spec.rb b/spec/ruby/library/digest/sha256/file_spec.rb index 3cccbb518f..6103971b5a 100644 --- a/spec/ruby/library/digest/sha256/file_spec.rb +++ b/spec/ruby/library/digest/sha256/file_spec.rb @@ -34,10 +34,10 @@ describe "Digest::SHA256.file" do it_behaves_like :file_read_directory, :file, Digest::SHA256 it "raises a Errno::ENOENT when passed a path that does not exist" do - lambda { Digest::SHA256.file("") }.should raise_error(Errno::ENOENT) + -> { Digest::SHA256.file("") }.should raise_error(Errno::ENOENT) end it "raises a TypeError when passed nil" do - lambda { Digest::SHA256.file(nil) }.should raise_error(TypeError) + -> { Digest::SHA256.file(nil) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/digest/sha384/file_spec.rb b/spec/ruby/library/digest/sha384/file_spec.rb index 376d819040..8556f10175 100644 --- a/spec/ruby/library/digest/sha384/file_spec.rb +++ b/spec/ruby/library/digest/sha384/file_spec.rb @@ -34,10 +34,10 @@ describe "Digest::SHA384.file" do it_behaves_like :file_read_directory, :file, Digest::SHA384 it "raises a Errno::ENOENT when passed a path that does not exist" do - lambda { Digest::SHA384.file("") }.should raise_error(Errno::ENOENT) + -> { Digest::SHA384.file("") }.should raise_error(Errno::ENOENT) end it "raises a TypeError when passed nil" do - lambda { Digest::SHA384.file(nil) }.should raise_error(TypeError) + -> { Digest::SHA384.file(nil) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/digest/sha512/file_spec.rb b/spec/ruby/library/digest/sha512/file_spec.rb index 0043146efa..781ec781e5 100644 --- a/spec/ruby/library/digest/sha512/file_spec.rb +++ b/spec/ruby/library/digest/sha512/file_spec.rb @@ -34,10 +34,10 @@ describe "Digest::SHA512.file" do it_behaves_like :file_read_directory, :file, Digest::SHA512 it "raises a Errno::ENOENT when passed a path that does not exist" do - lambda { Digest::SHA512.file("") }.should raise_error(Errno::ENOENT) + -> { Digest::SHA512.file("") }.should raise_error(Errno::ENOENT) end it "raises a TypeError when passed nil" do - lambda { Digest::SHA512.file(nil) }.should raise_error(TypeError) + -> { Digest::SHA512.file(nil) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/erb/filename_spec.rb b/spec/ruby/library/erb/filename_spec.rb index 26fed2897b..8ecaed7343 100644 --- a/spec/ruby/library/erb/filename_spec.rb +++ b/spec/ruby/library/erb/filename_spec.rb @@ -6,7 +6,7 @@ describe "ERB#filename" do filename = 'foobar.rhtml' erb = ERB.new('<% if true %>') # will raise SyntaxError erb.filename = filename - lambda { + -> { begin erb.result(binding) rescue Exception => e @@ -23,7 +23,7 @@ describe "ERB#filename" do it "uses '(erb)' as filename when filename is not set" do erb = ERB.new('<% if true %>') # will raise SyntaxError - lambda { + -> { begin erb.result(binding) rescue Exception => e diff --git a/spec/ruby/library/erb/new_spec.rb b/spec/ruby/library/erb/new_spec.rb index f1e5cd299e..3bb870dd3f 100644 --- a/spec/ruby/library/erb/new_spec.rb +++ b/spec/ruby/library/erb/new_spec.rb @@ -38,7 +38,7 @@ END ruby_version_is "2.6" do it "warns invalid trim_mode" do - lambda do + -> do ERBSpecs.new_erb(@eruby_str, trim_mode: '') end.should complain(/Invalid ERB trim mode/) end @@ -83,7 +83,7 @@ END </p> END - lambda { + -> { ERBSpecs.new_erb(input, trim_mode: '-').result }.should raise_error(SyntaxError) end @@ -143,6 +143,6 @@ END it "forget local variables defined previous one" do ERB.new(@eruby_str).result - lambda{ ERB.new("<%= list %>").result }.should raise_error(NameError) + ->{ ERB.new("<%= list %>").result }.should raise_error(NameError) end end diff --git a/spec/ruby/library/erb/result_spec.rb b/spec/ruby/library/erb/result_spec.rb index eb9d0c5356..a29c1ccedb 100644 --- a/spec/ruby/library/erb/result_spec.rb +++ b/spec/ruby/library/erb/result_spec.rb @@ -41,7 +41,7 @@ END it "is not able to h() or u() unless including ERB::Util" do input = "<%=h '<>' %>" - lambda { + -> { ERB.new(input).result() }.should raise_error(NameError) end @@ -79,7 +79,7 @@ END expected = '123' myerb2.new.main1().should == expected - lambda { + -> { myerb2.new.main2() }.should raise_error(NameError) end diff --git a/spec/ruby/library/erb/run_spec.rb b/spec/ruby/library/erb/run_spec.rb index c4b82b155e..8c07442d8f 100644 --- a/spec/ruby/library/erb/run_spec.rb +++ b/spec/ruby/library/erb/run_spec.rb @@ -52,7 +52,7 @@ END it "is not able to h() or u() unless including ERB::Util" do input = "<%=h '<>' %>" - lambda { + -> { _steal_stdout { ERB.new(input).run() } }.should raise_error(NameError) end @@ -89,7 +89,7 @@ END actual = _steal_stdout { myerb2.new.main1() } actual.should == expected - lambda { + -> { _steal_stdout { myerb2.new.main2() } }.should raise_error(NameError) end diff --git a/spec/ruby/library/etc/getgrgid_spec.rb b/spec/ruby/library/etc/getgrgid_spec.rb index 04758912b3..c7bd55b20e 100644 --- a/spec/ruby/library/etc/getgrgid_spec.rb +++ b/spec/ruby/library/etc/getgrgid_spec.rb @@ -54,12 +54,12 @@ platform_is_not :windows do end it "raises if the group does not exist" do - lambda { Etc.getgrgid(9876)}.should raise_error(ArgumentError) + -> { Etc.getgrgid(9876)}.should raise_error(ArgumentError) end it "raises a TypeError if not passed an Integer" do - lambda { Etc.getgrgid("foo") }.should raise_error(TypeError) - lambda { Etc.getgrgid(nil) }.should raise_error(TypeError) + -> { Etc.getgrgid("foo") }.should raise_error(TypeError) + -> { Etc.getgrgid(nil) }.should raise_error(TypeError) end it "can be called safely by multiple threads" do diff --git a/spec/ruby/library/etc/getgrnam_spec.rb b/spec/ruby/library/etc/getgrnam_spec.rb index 3fe94ed5f5..a7c624efbf 100644 --- a/spec/ruby/library/etc/getgrnam_spec.rb +++ b/spec/ruby/library/etc/getgrnam_spec.rb @@ -21,7 +21,7 @@ platform_is_not :windows do end it "only accepts strings as argument" do - lambda { + -> { Etc.getgrnam(123) Etc.getgrnam(nil) }.should raise_error(TypeError) diff --git a/spec/ruby/library/etc/getpwnam_spec.rb b/spec/ruby/library/etc/getpwnam_spec.rb index 2062ee51aa..3f4416aa9d 100644 --- a/spec/ruby/library/etc/getpwnam_spec.rb +++ b/spec/ruby/library/etc/getpwnam_spec.rb @@ -19,7 +19,7 @@ platform_is_not :windows do end it "only accepts strings as argument" do - lambda { + -> { Etc.getpwnam(123) Etc.getpwnam(nil) }.should raise_error(TypeError) diff --git a/spec/ruby/library/etc/getpwuid_spec.rb b/spec/ruby/library/etc/getpwuid_spec.rb index 3f6866ddc6..5b98f0f8d9 100644 --- a/spec/ruby/library/etc/getpwuid_spec.rb +++ b/spec/ruby/library/etc/getpwuid_spec.rb @@ -27,7 +27,7 @@ platform_is_not :windows do end it "only accepts integers as argument" do - lambda { + -> { Etc.getpwuid("foo") Etc.getpwuid(nil) }.should raise_error(TypeError) diff --git a/spec/ruby/library/expect/expect_spec.rb b/spec/ruby/library/expect/expect_spec.rb index 454023979f..a7041d42ee 100644 --- a/spec/ruby/library/expect/expect_spec.rb +++ b/spec/ruby/library/expect/expect_spec.rb @@ -37,7 +37,7 @@ platform_is_not :windows do @write << "prompt> hello" @read.close - lambda { + -> { @read.expect("hello") }.should raise_error(IOError) end diff --git a/spec/ruby/library/fiber/alive_spec.rb b/spec/ruby/library/fiber/alive_spec.rb index 0c20a1c6b8..47149d5279 100644 --- a/spec/ruby/library/fiber/alive_spec.rb +++ b/spec/ruby/library/fiber/alive_spec.rb @@ -30,16 +30,16 @@ describe "Fiber#alive?" do it "returns false for a Fiber that's dead" do fiber = Fiber.new { true } fiber.resume - lambda { fiber.resume }.should raise_error(FiberError) + -> { fiber.resume }.should raise_error(FiberError) fiber.alive?.should be_false end it "always returns false for a dead Fiber" do fiber = Fiber.new { true } fiber.resume - lambda { fiber.resume }.should raise_error(FiberError) + -> { fiber.resume }.should raise_error(FiberError) fiber.alive?.should be_false - lambda { fiber.resume }.should raise_error(FiberError) + -> { fiber.resume }.should raise_error(FiberError) fiber.alive?.should be_false fiber.alive?.should be_false end diff --git a/spec/ruby/library/fiber/resume_spec.rb b/spec/ruby/library/fiber/resume_spec.rb index 3d86aed94e..dae717c8a1 100644 --- a/spec/ruby/library/fiber/resume_spec.rb +++ b/spec/ruby/library/fiber/resume_spec.rb @@ -7,6 +7,6 @@ describe "Fiber#resume" do fiber1 = Fiber.new { true } fiber2 = Fiber.new { fiber1.transfer; Fiber.yield } fiber2.resume - lambda { fiber2.resume }.should raise_error(FiberError) + -> { fiber2.resume }.should raise_error(FiberError) end end diff --git a/spec/ruby/library/fiber/transfer_spec.rb b/spec/ruby/library/fiber/transfer_spec.rb index 1063bebeda..d13053666c 100644 --- a/spec/ruby/library/fiber/transfer_spec.rb +++ b/spec/ruby/library/fiber/transfer_spec.rb @@ -44,7 +44,7 @@ describe "Fiber#transfer" do it "raises a FiberError when transferring to a Fiber which resumes itself" do fiber = Fiber.new { fiber.resume } - lambda { fiber.transfer }.should raise_error(FiberError) + -> { fiber.transfer }.should raise_error(FiberError) end it "works if Fibers in different Threads each transfer to a Fiber in the same Thread" do diff --git a/spec/ruby/library/getoptlong/ordering_spec.rb b/spec/ruby/library/getoptlong/ordering_spec.rb index e6b645018d..695d1cafa7 100644 --- a/spec/ruby/library/getoptlong/ordering_spec.rb +++ b/spec/ruby/library/getoptlong/ordering_spec.rb @@ -9,7 +9,7 @@ describe "GetoptLong#ordering=" do opts.quiet = true opts.get - lambda { + -> { opts.ordering = GetoptLong::PERMUTE }.should raise_error(ArgumentError) end @@ -18,7 +18,7 @@ describe "GetoptLong#ordering=" do it "raises an ArgumentError if given an invalid value" do opts = GetoptLong.new - lambda { + -> { opts.ordering = 12345 }.should raise_error(ArgumentError) end diff --git a/spec/ruby/library/getoptlong/set_options_spec.rb b/spec/ruby/library/getoptlong/set_options_spec.rb index f2acccea28..36b9c579c4 100644 --- a/spec/ruby/library/getoptlong/set_options_spec.rb +++ b/spec/ruby/library/getoptlong/set_options_spec.rb @@ -39,7 +39,7 @@ describe "GetoptLong#set_options" do it "raises an ArgumentError if too many argument flags where given" do argv [] do - lambda { + -> { @opts.set_options(["--size", GetoptLong::NO_ARGUMENT, GetoptLong::REQUIRED_ARGUMENT]) }.should raise_error(ArgumentError) end @@ -48,7 +48,7 @@ describe "GetoptLong#set_options" do it "raises a RuntimeError if processing has already started" do argv [] do @opts.get - lambda { + -> { @opts.set_options() }.should raise_error(RuntimeError) end @@ -56,7 +56,7 @@ describe "GetoptLong#set_options" do it "raises an ArgumentError if no argument flag was given" do argv [] do - lambda { + -> { @opts.set_options(["--size"]) }.should raise_error(ArgumentError) end @@ -64,7 +64,7 @@ describe "GetoptLong#set_options" do it "raises an ArgumentError if one of the given arguments is not an Array" do argv [] do - lambda { + -> { @opts.set_options( ["--size", GetoptLong::REQUIRED_ARGUMENT], "test") @@ -74,13 +74,13 @@ describe "GetoptLong#set_options" do it "raises an ArgumentError if the same option is given twice" do argv [] do - lambda { + -> { @opts.set_options( ["--size", GetoptLong::NO_ARGUMENT], ["--size", GetoptLong::OPTIONAL_ARGUMENT]) }.should raise_error(ArgumentError) - lambda { + -> { @opts.set_options( ["--size", GetoptLong::NO_ARGUMENT], ["-s", "--size", GetoptLong::OPTIONAL_ARGUMENT]) @@ -90,7 +90,7 @@ describe "GetoptLong#set_options" do it "raises an ArgumentError if the given option is invalid" do argv [] do - lambda { + -> { @opts.set_options(["-size", GetoptLong::NO_ARGUMENT]) }.should raise_error(ArgumentError) end diff --git a/spec/ruby/library/getoptlong/shared/get.rb b/spec/ruby/library/getoptlong/shared/get.rb index 91a0fbaacc..772a7f6773 100644 --- a/spec/ruby/library/getoptlong/shared/get.rb +++ b/spec/ruby/library/getoptlong/shared/get.rb @@ -49,7 +49,7 @@ describe :getoptlong_get, shared: true do it "raises a if an argument was required, but none given" do argv [ "--size" ] do - lambda { @opts.send(@method) }.should raise_error(GetoptLong::MissingArgument) + -> { @opts.send(@method) }.should raise_error(GetoptLong::MissingArgument) end end diff --git a/spec/ruby/library/ipaddr/new_spec.rb b/spec/ruby/library/ipaddr/new_spec.rb index 77165d2857..c8c8bc80b3 100644 --- a/spec/ruby/library/ipaddr/new_spec.rb +++ b/spec/ruby/library/ipaddr/new_spec.rb @@ -3,9 +3,9 @@ require 'ipaddr' describe "IPAddr#new" do it "initializes IPAddr" do - lambda{ IPAddr.new("3FFE:505:ffff::/48") }.should_not raise_error - lambda{ IPAddr.new("0:0:0:1::") }.should_not raise_error - lambda{ IPAddr.new("2001:200:300::/48") }.should_not raise_error + ->{ IPAddr.new("3FFE:505:ffff::/48") }.should_not raise_error + ->{ IPAddr.new("0:0:0:1::") }.should_not raise_error + ->{ IPAddr.new("2001:200:300::/48") }.should_not raise_error end it "initializes IPAddr ipv6 address with short notation" do @@ -85,7 +85,7 @@ describe "IPAddr#new" do ["::ffff:192.168.1.2/120", Socket::AF_INET], ["[192.168.1.2]/120"], ].each { |args| - lambda{ + ->{ IPAddr.new(*args) }.should raise_error(ArgumentError) } diff --git a/spec/ruby/library/ipaddr/reverse_spec.rb b/spec/ruby/library/ipaddr/reverse_spec.rb index db39b6c7a0..6ebb343269 100644 --- a/spec/ruby/library/ipaddr/reverse_spec.rb +++ b/spec/ruby/library/ipaddr/reverse_spec.rb @@ -11,7 +11,7 @@ end describe "IPAddr#ip6_arpa" do it "converts an IPv6 address into the reverse DNS lookup representation according to RFC3172" do IPAddr.new("3ffe:505:2::f").ip6_arpa.should == "f.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.0.5.0.5.0.e.f.f.3.ip6.arpa" - lambda{ + ->{ IPAddr.new("192.168.2.1").ip6_arpa }.should raise_error(ArgumentError) end @@ -20,7 +20,7 @@ end describe "IPAddr#ip6_int" do it "converts an IPv6 address into the reverse DNS lookup representation according to RFC1886" do IPAddr.new("3ffe:505:2::f").ip6_int.should == "f.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.0.5.0.5.0.e.f.f.3.ip6.int" - lambda{ + ->{ IPAddr.new("192.168.2.1").ip6_int }.should raise_error(ArgumentError) end diff --git a/spec/ruby/library/logger/device/close_spec.rb b/spec/ruby/library/logger/device/close_spec.rb index 3fd96675a4..d7d107fcce 100644 --- a/spec/ruby/library/logger/device/close_spec.rb +++ b/spec/ruby/library/logger/device/close_spec.rb @@ -18,14 +18,14 @@ describe "Logger::LogDevice#close" do ruby_version_is ""..."2.7" do it "closes the LogDevice's stream" do @device.close - lambda { @device.write("Test") }.should complain(/\Alog writing failed\./) + -> { @device.write("Test") }.should complain(/\Alog writing failed\./) end end ruby_version_is "2.7" do it "closes the LogDevice's stream" do @device.close - lambda { @device.write("Test") }.should complain(/\Alog shifting failed\./) + -> { @device.write("Test") }.should complain(/\Alog shifting failed\./) end end end diff --git a/spec/ruby/library/logger/device/new_spec.rb b/spec/ruby/library/logger/device/new_spec.rb index a66c364392..578624a91c 100644 --- a/spec/ruby/library/logger/device/new_spec.rb +++ b/spec/ruby/library/logger/device/new_spec.rb @@ -40,7 +40,7 @@ describe "Logger::LogDevice#new" do end it "receives options via a hash as second argument" do - lambda { Logger::LogDevice.new(STDERR, + -> { Logger::LogDevice.new(STDERR, { shift_age: 8, shift_size: 10 })}.should_not raise_error end diff --git a/spec/ruby/library/logger/device/write_spec.rb b/spec/ruby/library/logger/device/write_spec.rb index 6f4e13c8e6..5506bb2c38 100644 --- a/spec/ruby/library/logger/device/write_spec.rb +++ b/spec/ruby/library/logger/device/write_spec.rb @@ -38,14 +38,14 @@ describe "Logger::LogDevice#write" do ruby_version_is ""..."2.7" do it "fails if the device is already closed" do @device.close - lambda { @device.write "foo" }.should complain(/\Alog writing failed\./) + -> { @device.write "foo" }.should complain(/\Alog writing failed\./) end end ruby_version_is "2.7" do it "fails if the device is already closed" do @device.close - lambda { @device.write "foo" }.should complain(/\Alog shifting failed\./) + -> { @device.write "foo" }.should complain(/\Alog shifting failed\./) end end end diff --git a/spec/ruby/library/logger/logger/add_spec.rb b/spec/ruby/library/logger/logger/add_spec.rb index 85a3b5ae3c..3f709e18ba 100644 --- a/spec/ruby/library/logger/logger/add_spec.rb +++ b/spec/ruby/library/logger/logger/add_spec.rb @@ -52,7 +52,7 @@ describe "Logger#add" do end it "receives a block" do - lambda { + -> { @logger.log(nil, "test", "TestApp") do 1+1 end @@ -61,7 +61,7 @@ describe "Logger#add" do it "calls the block if message is nil" do temp = 0 - lambda { + -> { @logger.log(nil, nil, "TestApp") do temp = 1+1 end @@ -71,7 +71,7 @@ describe "Logger#add" do it "ignores the block if the message is not nil" do temp = 0 - lambda { + -> { @logger.log(nil, "not nil", "TestApp") do temp = 1+1 end diff --git a/spec/ruby/library/logger/logger/close_spec.rb b/spec/ruby/library/logger/logger/close_spec.rb index 45da2fa770..81aac2a6cd 100644 --- a/spec/ruby/library/logger/logger/close_spec.rb +++ b/spec/ruby/library/logger/logger/close_spec.rb @@ -15,6 +15,6 @@ describe "Logger#close" do it "closes the logging device" do @logger.close - lambda { @logger.add(nil, "Foo") }.should complain(/\Alog writing failed\./) + -> { @logger.add(nil, "Foo") }.should complain(/\Alog writing failed\./) end end diff --git a/spec/ruby/library/logger/logger/datetime_format_spec.rb b/spec/ruby/library/logger/logger/datetime_format_spec.rb index 39fd29bd3f..582b34bfda 100644 --- a/spec/ruby/library/logger/logger/datetime_format_spec.rb +++ b/spec/ruby/library/logger/logger/datetime_format_spec.rb @@ -49,7 +49,7 @@ describe "Logger#datetime_format=" do end it "follows the Time#strftime format" do - lambda { @logger.datetime_format = "%Y-%m" }.should_not raise_error + -> { @logger.datetime_format = "%Y-%m" }.should_not raise_error regex = /\d{4}-\d{2}-\d{2}oo-\w+ar/ @logger.datetime_format = "%Foo-%Bar" diff --git a/spec/ruby/library/logger/logger/new_spec.rb b/spec/ruby/library/logger/logger/new_spec.rb index 43f701a3dd..f70e1904f3 100644 --- a/spec/ruby/library/logger/logger/new_spec.rb +++ b/spec/ruby/library/logger/logger/new_spec.rb @@ -15,7 +15,7 @@ describe "Logger#new" do it "creates a new logger object" do l = Logger.new(STDERR) - lambda { l.add(Logger::WARN, "Foo") }.should output_to_fd(/Foo/, STDERR) + -> { l.add(Logger::WARN, "Foo") }.should output_to_fd(/Foo/, STDERR) end it "receives a logging device as first argument" do @@ -28,13 +28,13 @@ describe "Logger#new" do end it "receives a frequency rotation as second argument" do - lambda { Logger.new(@log_file, "daily") }.should_not raise_error - lambda { Logger.new(@log_file, "weekly") }.should_not raise_error - lambda { Logger.new(@log_file, "monthly") }.should_not raise_error + -> { Logger.new(@log_file, "daily") }.should_not raise_error + -> { Logger.new(@log_file, "weekly") }.should_not raise_error + -> { Logger.new(@log_file, "monthly") }.should_not raise_error end it "also receives a number of log files to keep as second argument" do - lambda { Logger.new(@log_file, 1).close }.should_not raise_error + -> { Logger.new(@log_file, 1).close }.should_not raise_error end it "receives a maximum logfile size as third argument" do diff --git a/spec/ruby/library/logger/logger/unknown_spec.rb b/spec/ruby/library/logger/logger/unknown_spec.rb index 4a042f9215..b174b8b2c9 100644 --- a/spec/ruby/library/logger/logger/unknown_spec.rb +++ b/spec/ruby/library/logger/logger/unknown_spec.rb @@ -29,7 +29,7 @@ describe "Logger#unknown" do end it "receives empty messages" do - lambda { @logger.unknown("") }.should_not raise_error + -> { @logger.unknown("") }.should_not raise_error @log_file.rewind LoggerSpecs.strip_date(@log_file.readlines.first).should == "ANY -- : \n" end diff --git a/spec/ruby/library/mathn/integer/prime_division_spec.rb b/spec/ruby/library/mathn/integer/prime_division_spec.rb index e2141490f0..fb4a1c3fea 100644 --- a/spec/ruby/library/mathn/integer/prime_division_spec.rb +++ b/spec/ruby/library/mathn/integer/prime_division_spec.rb @@ -15,7 +15,7 @@ ruby_version_is ''...'2.5' do end it "raises a ZeroDivisionError when is called on zero" do - lambda { 0.prime_division }.should raise_error(ZeroDivisionError) + -> { 0.prime_division }.should raise_error(ZeroDivisionError) end end end diff --git a/spec/ruby/library/mathn/math/shared/rsqrt.rb b/spec/ruby/library/mathn/math/shared/rsqrt.rb index 0f623a7d4f..ea3d1b0cfc 100644 --- a/spec/ruby/library/mathn/math/shared/rsqrt.rb +++ b/spec/ruby/library/mathn/math/shared/rsqrt.rb @@ -14,8 +14,8 @@ describe :mathn_math_rsqrt, shared: true do end it "raises an Math::DomainError if the argument is a negative number" do - lambda { @object.send(:rsqrt, -1) }.should raise_error(Math::DomainError) - lambda { @object.send(:rsqrt, -4.0) }.should raise_error(Math::DomainError) - lambda { @object.send(:rsqrt, -16/64) }.should raise_error(Math::DomainError) + -> { @object.send(:rsqrt, -1) }.should raise_error(Math::DomainError) + -> { @object.send(:rsqrt, -4.0) }.should raise_error(Math::DomainError) + -> { @object.send(:rsqrt, -16/64) }.should raise_error(Math::DomainError) end end diff --git a/spec/ruby/library/matrix/antisymmetric_spec.rb b/spec/ruby/library/matrix/antisymmetric_spec.rb index 534fab60ea..3eb0f8b726 100644 --- a/spec/ruby/library/matrix/antisymmetric_spec.rb +++ b/spec/ruby/library/matrix/antisymmetric_spec.rb @@ -28,7 +28,7 @@ ruby_version_is "2.6" do Matrix.empty(0, 2), Matrix.empty(2, 0), ].each do |rectangular_matrix| - lambda { + -> { rectangular_matrix.antisymmetric? }.should raise_error(Matrix::ErrDimensionMismatch) end diff --git a/spec/ruby/library/matrix/build_spec.rb b/spec/ruby/library/matrix/build_spec.rb index 6819b9b617..6d8017a3df 100644 --- a/spec/ruby/library/matrix/build_spec.rb +++ b/spec/ruby/library/matrix/build_spec.rb @@ -29,14 +29,14 @@ describe "Matrix.build" do end it "requires integers as parameters" do - lambda { Matrix.build("1", "2"){1} }.should raise_error(TypeError) - lambda { Matrix.build(nil, nil){1} }.should raise_error(TypeError) - lambda { Matrix.build(1..2){1} }.should raise_error(TypeError) + -> { Matrix.build("1", "2"){1} }.should raise_error(TypeError) + -> { Matrix.build(nil, nil){1} }.should raise_error(TypeError) + -> { Matrix.build(1..2){1} }.should raise_error(TypeError) end it "requires non-negative integers" do - lambda { Matrix.build(-1, 1){1} }.should raise_error(ArgumentError) - lambda { Matrix.build(+1,-1){1} }.should raise_error(ArgumentError) + -> { Matrix.build(-1, 1){1} }.should raise_error(ArgumentError) + -> { Matrix.build(+1,-1){1} }.should raise_error(ArgumentError) end it "returns empty Matrix if one argument is zero" do diff --git a/spec/ruby/library/matrix/column_spec.rb b/spec/ruby/library/matrix/column_spec.rb index 46cd57f2b3..1f3c80964a 100644 --- a/spec/ruby/library/matrix/column_spec.rb +++ b/spec/ruby/library/matrix/column_spec.rb @@ -29,7 +29,7 @@ describe "Matrix#column" do end it "never yields when out of bounds" do - lambda { @m.column(3){ raise } }.should_not raise_error - lambda { @m.column(-4){ raise } }.should_not raise_error + -> { @m.column(3){ raise } }.should_not raise_error + -> { @m.column(-4){ raise } }.should_not raise_error end end diff --git a/spec/ruby/library/matrix/constructor_spec.rb b/spec/ruby/library/matrix/constructor_spec.rb index 2479923fb5..70d77babbb 100644 --- a/spec/ruby/library/matrix/constructor_spec.rb +++ b/spec/ruby/library/matrix/constructor_spec.rb @@ -5,10 +5,10 @@ require 'matrix' describe "Matrix.[]" do it "requires arrays as parameters" do - lambda { Matrix[5] }.should raise_error(TypeError) - lambda { Matrix[nil] }.should raise_error(TypeError) - lambda { Matrix[1..2] }.should raise_error(TypeError) - lambda { Matrix[[1, 2], 3] }.should raise_error(TypeError) + -> { Matrix[5] }.should raise_error(TypeError) + -> { Matrix[nil] }.should raise_error(TypeError) + -> { Matrix[1..2] }.should raise_error(TypeError) + -> { Matrix[[1, 2], 3] }.should raise_error(TypeError) end it "creates an empty Matrix with no arguments" do @@ -18,9 +18,9 @@ describe "Matrix.[]" do end it "raises for non-rectangular matrices" do - lambda{ Matrix[ [0], [0,1] ] }.should \ + ->{ Matrix[ [0], [0,1] ] }.should \ raise_error(Matrix::ErrDimensionMismatch) - lambda{ Matrix[ [0,1], [0,1,2], [0,1] ]}.should \ + ->{ Matrix[ [0,1], [0,1,2], [0,1] ]}.should \ raise_error(Matrix::ErrDimensionMismatch) end diff --git a/spec/ruby/library/matrix/diagonal_spec.rb b/spec/ruby/library/matrix/diagonal_spec.rb index f066a21c47..ef9738e73e 100644 --- a/spec/ruby/library/matrix/diagonal_spec.rb +++ b/spec/ruby/library/matrix/diagonal_spec.rb @@ -64,7 +64,7 @@ describe "Matrix.diagonal?" do Matrix.empty(0, 2), Matrix.empty(2, 0), ].each do |rectangular_matrix| - lambda { + -> { rectangular_matrix.diagonal? }.should raise_error(Matrix::ErrDimensionMismatch) end diff --git a/spec/ruby/library/matrix/divide_spec.rb b/spec/ruby/library/matrix/divide_spec.rb index 205bc5d892..2e3bb85bf6 100644 --- a/spec/ruby/library/matrix/divide_spec.rb +++ b/spec/ruby/library/matrix/divide_spec.rb @@ -30,7 +30,7 @@ describe "Matrix#/" do end it "raises a Matrix::ErrDimensionMismatch if the matrices are different sizes" do - lambda { @a / Matrix[ [1] ] }.should raise_error(Matrix::ErrDimensionMismatch) + -> { @a / Matrix[ [1] ] }.should raise_error(Matrix::ErrDimensionMismatch) end it "returns an instance of Matrix" do @@ -46,9 +46,9 @@ describe "Matrix#/" do end it "raises a TypeError if other is of wrong type" do - lambda { @a / nil }.should raise_error(TypeError) - lambda { @a / "a" }.should raise_error(TypeError) - lambda { @a / [ [1, 2] ] }.should raise_error(TypeError) - lambda { @a / Object.new }.should raise_error(TypeError) + -> { @a / nil }.should raise_error(TypeError) + -> { @a / "a" }.should raise_error(TypeError) + -> { @a / [ [1, 2] ] }.should raise_error(TypeError) + -> { @a / Object.new }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/matrix/each_spec.rb b/spec/ruby/library/matrix/each_spec.rb index 214aae1a3a..f3b0f01867 100644 --- a/spec/ruby/library/matrix/each_spec.rb +++ b/spec/ruby/library/matrix/each_spec.rb @@ -31,13 +31,13 @@ describe "Matrix#each with an argument" do end it "raises an ArgumentError for unrecognized argument" do - lambda { + -> { @m.each("all"){} }.should raise_error(ArgumentError) - lambda { + -> { @m.each(nil){} }.should raise_error(ArgumentError) - lambda { + -> { @m.each(:left){} }.should raise_error(ArgumentError) end diff --git a/spec/ruby/library/matrix/each_with_index_spec.rb b/spec/ruby/library/matrix/each_with_index_spec.rb index 36a1309292..a005b88621 100644 --- a/spec/ruby/library/matrix/each_with_index_spec.rb +++ b/spec/ruby/library/matrix/each_with_index_spec.rb @@ -38,13 +38,13 @@ describe "Matrix#each_with_index with an argument" do end it "raises an ArgumentError for unrecognized argument" do - lambda { + -> { @m.each_with_index("all"){} }.should raise_error(ArgumentError) - lambda { + -> { @m.each_with_index(nil){} }.should raise_error(ArgumentError) - lambda { + -> { @m.each_with_index(:left){} }.should raise_error(ArgumentError) end diff --git a/spec/ruby/library/matrix/eigenvalue_decomposition/initialize_spec.rb b/spec/ruby/library/matrix/eigenvalue_decomposition/initialize_spec.rb index f8964070d9..8438f63133 100644 --- a/spec/ruby/library/matrix/eigenvalue_decomposition/initialize_spec.rb +++ b/spec/ruby/library/matrix/eigenvalue_decomposition/initialize_spec.rb @@ -3,16 +3,16 @@ require 'matrix' describe "Matrix::EigenvalueDecomposition#initialize" do it "raises an error if argument is not a matrix" do - lambda { + -> { Matrix::EigenvalueDecomposition.new([[]]) }.should raise_error(TypeError) - lambda { + -> { Matrix::EigenvalueDecomposition.new(42) }.should raise_error(TypeError) end it "raises an error if matrix is not square" do - lambda { + -> { Matrix::EigenvalueDecomposition.new(Matrix[[1, 2]]) }.should raise_error(Matrix::ErrDimensionMismatch) end diff --git a/spec/ruby/library/matrix/empty_spec.rb b/spec/ruby/library/matrix/empty_spec.rb index ce23d926d6..5f294711db 100644 --- a/spec/ruby/library/matrix/empty_spec.rb +++ b/spec/ruby/library/matrix/empty_spec.rb @@ -15,7 +15,7 @@ describe "Matrix#empty?" do end it "doesn't accept any parameter" do - lambda{ + ->{ Matrix[ [1, 2] ].empty?(42) }.should raise_error(ArgumentError) end @@ -38,23 +38,23 @@ describe "Matrix.empty" do end it "does not accept more than two parameters" do - lambda{ + ->{ Matrix.empty(1, 2, 3) }.should raise_error(ArgumentError) end it "raises an error if both dimensions are > 0" do - lambda{ + ->{ Matrix.empty(1, 2) }.should raise_error(ArgumentError) end it "raises an error if any dimension is < 0" do - lambda{ + ->{ Matrix.empty(-2, 0) }.should raise_error(ArgumentError) - lambda{ + ->{ Matrix.empty(0, -2) }.should raise_error(ArgumentError) end diff --git a/spec/ruby/library/matrix/exponent_spec.rb b/spec/ruby/library/matrix/exponent_spec.rb index c496d9d3cc..447c962967 100644 --- a/spec/ruby/library/matrix/exponent_spec.rb +++ b/spec/ruby/library/matrix/exponent_spec.rb @@ -17,8 +17,8 @@ describe "Matrix#**" do it "raises a ErrDimensionMismatch for non square matrices" do m = Matrix[ [1, 1], [1, 2], [2, 3]] - lambda { m ** 3 }.should raise_error(Matrix::ErrDimensionMismatch) - lambda { m ** 0 }.should raise_error(Matrix::ErrDimensionMismatch) + -> { m ** 3 }.should raise_error(Matrix::ErrDimensionMismatch) + -> { m ** 0 }.should raise_error(Matrix::ErrDimensionMismatch) end describe "that is <= 0" do @@ -30,8 +30,8 @@ describe "Matrix#**" do it "raises a ErrDimensionMismatch for irregular matrices" do m = Matrix[ [1, 1], [1, 1] ] - lambda { m ** -2 }.should raise_error(Matrix::ErrNotRegular) - lambda { m ** 0 }.should raise_error(Matrix::ErrNotRegular) + -> { m ** -2 }.should raise_error(Matrix::ErrNotRegular) + -> { m ** 0 }.should raise_error(Matrix::ErrNotRegular) end end end diff --git a/spec/ruby/library/matrix/find_index_spec.rb b/spec/ruby/library/matrix/find_index_spec.rb index 27672e526b..c2bfa6d61a 100644 --- a/spec/ruby/library/matrix/find_index_spec.rb +++ b/spec/ruby/library/matrix/find_index_spec.rb @@ -130,16 +130,16 @@ end describe "Matrix#find_index with two arguments" do it "raises an ArgumentError for an unrecognized last argument" do - lambda { + -> { @m.find_index(1, "all"){} }.should raise_error(ArgumentError) - lambda { + -> { @m.find_index(1, nil){} }.should raise_error(ArgumentError) - lambda { + -> { @m.find_index(1, :left){} }.should raise_error(ArgumentError) - lambda { + -> { @m.find_index(:diagonal, 1){} }.should raise_error(ArgumentError) end diff --git a/spec/ruby/library/matrix/hermitian_spec.rb b/spec/ruby/library/matrix/hermitian_spec.rb index dda5280d64..177ca64d83 100644 --- a/spec/ruby/library/matrix/hermitian_spec.rb +++ b/spec/ruby/library/matrix/hermitian_spec.rb @@ -21,7 +21,7 @@ describe "Matrix.hermitian?" do Matrix.empty(0, 2), Matrix.empty(2, 0), ].each do |rectangular_matrix| - lambda { + -> { rectangular_matrix.hermitian? }.should raise_error(Matrix::ErrDimensionMismatch) end diff --git a/spec/ruby/library/matrix/lup_decomposition/determinant_spec.rb b/spec/ruby/library/matrix/lup_decomposition/determinant_spec.rb index ca2ddf18c6..9d733066c1 100644 --- a/spec/ruby/library/matrix/lup_decomposition/determinant_spec.rb +++ b/spec/ruby/library/matrix/lup_decomposition/determinant_spec.rb @@ -13,7 +13,7 @@ describe "Matrix::LUPDecomposition#determinant" do Matrix[[7, 8], [14, 46], [28, 82]], ].each do |m| lup = m.lup - lambda { + -> { lup.determinant }.should raise_error(Matrix::ErrDimensionMismatch) end diff --git a/spec/ruby/library/matrix/lup_decomposition/initialize_spec.rb b/spec/ruby/library/matrix/lup_decomposition/initialize_spec.rb index 00dc47ddb9..36afb349e6 100644 --- a/spec/ruby/library/matrix/lup_decomposition/initialize_spec.rb +++ b/spec/ruby/library/matrix/lup_decomposition/initialize_spec.rb @@ -3,10 +3,10 @@ require 'matrix' describe "Matrix::LUPDecomposition#initialize" do it "raises an error if argument is not a matrix" do - lambda { + -> { Matrix::LUPDecomposition.new([[]]) }.should raise_error(TypeError) - lambda { + -> { Matrix::LUPDecomposition.new(42) }.should raise_error(TypeError) end diff --git a/spec/ruby/library/matrix/lup_decomposition/solve_spec.rb b/spec/ruby/library/matrix/lup_decomposition/solve_spec.rb index 43d49de9c7..66242627e9 100644 --- a/spec/ruby/library/matrix/lup_decomposition/solve_spec.rb +++ b/spec/ruby/library/matrix/lup_decomposition/solve_spec.rb @@ -6,7 +6,7 @@ describe "Matrix::LUPDecomposition#solve" do it "raises an error for singular matrices" do a = Matrix[[1, 2, 3], [1, 3, 5], [2, 5, 8]] lu = Matrix::LUPDecomposition.new(a) - lambda { + -> { lu.solve(a) }.should raise_error(Matrix::ErrNotRegular) end @@ -31,7 +31,7 @@ describe "Matrix::LUPDecomposition#solve" do it "raises an error when given a matrix of the wrong size" do values = Matrix[[1, 2, 3, 4], [0, 1, 2, 3]] - lambda { + -> { @lu.solve(values) }.should raise_error(Matrix::ErrDimensionMismatch) end @@ -44,7 +44,7 @@ describe "Matrix::LUPDecomposition#solve" do it "raises an error when given a vector of the wrong size" do values = Vector[14, 55] - lambda { + -> { @lu.solve(values) }.should raise_error(Matrix::ErrDimensionMismatch) end diff --git a/spec/ruby/library/matrix/minus_spec.rb b/spec/ruby/library/matrix/minus_spec.rb index 25191893a6..95cf4a6072 100644 --- a/spec/ruby/library/matrix/minus_spec.rb +++ b/spec/ruby/library/matrix/minus_spec.rb @@ -17,20 +17,20 @@ describe "Matrix#-" do end it "raises a Matrix::ErrDimensionMismatch if the matrices are different sizes" do - lambda { @a - Matrix[ [1] ] }.should raise_error(Matrix::ErrDimensionMismatch) + -> { @a - Matrix[ [1] ] }.should raise_error(Matrix::ErrDimensionMismatch) end it "raises a ExceptionForMatrix::ErrOperationNotDefined if other is a Numeric Type" do - lambda { @a - 2 }.should raise_error(Matrix::ErrOperationNotDefined) - lambda { @a - 1.2 }.should raise_error(Matrix::ErrOperationNotDefined) - lambda { @a - bignum_value }.should raise_error(Matrix::ErrOperationNotDefined) + -> { @a - 2 }.should raise_error(Matrix::ErrOperationNotDefined) + -> { @a - 1.2 }.should raise_error(Matrix::ErrOperationNotDefined) + -> { @a - bignum_value }.should raise_error(Matrix::ErrOperationNotDefined) end it "raises a TypeError if other is of wrong type" do - lambda { @a - nil }.should raise_error(TypeError) - lambda { @a - "a" }.should raise_error(TypeError) - lambda { @a - [ [1, 2] ] }.should raise_error(TypeError) - lambda { @a - Object.new }.should raise_error(TypeError) + -> { @a - nil }.should raise_error(TypeError) + -> { @a - "a" }.should raise_error(TypeError) + -> { @a - [ [1, 2] ] }.should raise_error(TypeError) + -> { @a - Object.new }.should raise_error(TypeError) end describe "for a subclass of Matrix" do diff --git a/spec/ruby/library/matrix/multiply_spec.rb b/spec/ruby/library/matrix/multiply_spec.rb index 9b401a4dad..585f268931 100644 --- a/spec/ruby/library/matrix/multiply_spec.rb +++ b/spec/ruby/library/matrix/multiply_spec.rb @@ -32,7 +32,7 @@ describe "Matrix#*" do end it "raises a Matrix::ErrDimensionMismatch if the matrices are different sizes" do - lambda { @a * Matrix[ [1] ] }.should raise_error(Matrix::ErrDimensionMismatch) + -> { @a * Matrix[ [1] ] }.should raise_error(Matrix::ErrDimensionMismatch) end it "returns a zero matrix if (nx0) * (0xn)" do @@ -52,10 +52,10 @@ describe "Matrix#*" do end it "raises a TypeError if other is of wrong type" do - lambda { @a * nil }.should raise_error(TypeError) - lambda { @a * "a" }.should raise_error(TypeError) - lambda { @a * [ [1, 2] ] }.should raise_error(TypeError) - lambda { @a * Object.new }.should raise_error(TypeError) + -> { @a * nil }.should raise_error(TypeError) + -> { @a * "a" }.should raise_error(TypeError) + -> { @a * [ [1, 2] ] }.should raise_error(TypeError) + -> { @a * Object.new }.should raise_error(TypeError) end describe "for a subclass of Matrix" do diff --git a/spec/ruby/library/matrix/normal_spec.rb b/spec/ruby/library/matrix/normal_spec.rb index 437a3c82c9..ebd73aaf40 100644 --- a/spec/ruby/library/matrix/normal_spec.rb +++ b/spec/ruby/library/matrix/normal_spec.rb @@ -18,7 +18,7 @@ describe "Matrix.normal?" do Matrix.empty(0, 2), Matrix.empty(2, 0), ].each do |rectangular_matrix| - lambda { + -> { rectangular_matrix.normal? }.should raise_error(Matrix::ErrDimensionMismatch) end diff --git a/spec/ruby/library/matrix/orthogonal_spec.rb b/spec/ruby/library/matrix/orthogonal_spec.rb index 81df1d15ee..07b098a58d 100644 --- a/spec/ruby/library/matrix/orthogonal_spec.rb +++ b/spec/ruby/library/matrix/orthogonal_spec.rb @@ -18,7 +18,7 @@ describe "Matrix.orthogonal?" do Matrix.empty(0, 2), Matrix.empty(2, 0), ].each do |rectangular_matrix| - lambda { + -> { rectangular_matrix.orthogonal? }.should raise_error(Matrix::ErrDimensionMismatch) end diff --git a/spec/ruby/library/matrix/permutation_spec.rb b/spec/ruby/library/matrix/permutation_spec.rb index f6666588de..825a9d982c 100644 --- a/spec/ruby/library/matrix/permutation_spec.rb +++ b/spec/ruby/library/matrix/permutation_spec.rb @@ -24,7 +24,7 @@ describe "Matrix#permutation?" do Matrix.empty(0, 2), Matrix.empty(2, 0), ].each do |rectangular_matrix| - lambda { + -> { rectangular_matrix.permutation? }.should raise_error(Matrix::ErrDimensionMismatch) end diff --git a/spec/ruby/library/matrix/plus_spec.rb b/spec/ruby/library/matrix/plus_spec.rb index cad04f80a3..2706bad060 100644 --- a/spec/ruby/library/matrix/plus_spec.rb +++ b/spec/ruby/library/matrix/plus_spec.rb @@ -17,20 +17,20 @@ describe "Matrix#+" do end it "raises a Matrix::ErrDimensionMismatch if the matrices are different sizes" do - lambda { @a + Matrix[ [1] ] }.should raise_error(Matrix::ErrDimensionMismatch) + -> { @a + Matrix[ [1] ] }.should raise_error(Matrix::ErrDimensionMismatch) end it "raises a ExceptionForMatrix::ErrOperationNotDefined if other is a Numeric Type" do - lambda { @a + 2 }.should raise_error(ExceptionForMatrix::ErrOperationNotDefined) - lambda { @a + 1.2 }.should raise_error(ExceptionForMatrix::ErrOperationNotDefined) - lambda { @a + bignum_value }.should raise_error(ExceptionForMatrix::ErrOperationNotDefined) + -> { @a + 2 }.should raise_error(ExceptionForMatrix::ErrOperationNotDefined) + -> { @a + 1.2 }.should raise_error(ExceptionForMatrix::ErrOperationNotDefined) + -> { @a + bignum_value }.should raise_error(ExceptionForMatrix::ErrOperationNotDefined) end it "raises a TypeError if other is of wrong type" do - lambda { @a + nil }.should raise_error(TypeError) - lambda { @a + "a" }.should raise_error(TypeError) - lambda { @a + [ [1, 2] ] }.should raise_error(TypeError) - lambda { @a + Object.new }.should raise_error(TypeError) + -> { @a + nil }.should raise_error(TypeError) + -> { @a + "a" }.should raise_error(TypeError) + -> { @a + [ [1, 2] ] }.should raise_error(TypeError) + -> { @a + Object.new }.should raise_error(TypeError) end describe "for a subclass of Matrix" do diff --git a/spec/ruby/library/matrix/regular_spec.rb b/spec/ruby/library/matrix/regular_spec.rb index 5dd4484ce4..3699d0ef8b 100644 --- a/spec/ruby/library/matrix/regular_spec.rb +++ b/spec/ruby/library/matrix/regular_spec.rb @@ -20,11 +20,11 @@ describe "Matrix#regular?" do end it "raises an error for rectangular matrices" do - lambda { + -> { Matrix[[1], [2], [3]].regular? }.should raise_error(Matrix::ErrDimensionMismatch) - lambda { + -> { Matrix.empty(3,0).regular? }.should raise_error(Matrix::ErrDimensionMismatch) end diff --git a/spec/ruby/library/matrix/row_spec.rb b/spec/ruby/library/matrix/row_spec.rb index 1cf2c6ae2c..00b1f02a8e 100644 --- a/spec/ruby/library/matrix/row_spec.rb +++ b/spec/ruby/library/matrix/row_spec.rb @@ -30,7 +30,7 @@ describe "Matrix#row" do end it "never yields when out of bounds" do - lambda { @m.row(3){ raise } }.should_not raise_error - lambda { @m.row(-4){ raise } }.should_not raise_error + -> { @m.row(3){ raise } }.should_not raise_error + -> { @m.row(-4){ raise } }.should_not raise_error end end diff --git a/spec/ruby/library/matrix/shared/determinant.rb b/spec/ruby/library/matrix/shared/determinant.rb index 47a58c62a6..9e0528c24b 100644 --- a/spec/ruby/library/matrix/shared/determinant.rb +++ b/spec/ruby/library/matrix/shared/determinant.rb @@ -27,11 +27,11 @@ describe :determinant, shared: true do end it "raises an error for rectangular matrices" do - lambda { + -> { Matrix[[1], [2], [3]].send(@method) }.should raise_error(Matrix::ErrDimensionMismatch) - lambda { + -> { Matrix.empty(3,0).send(@method) }.should raise_error(Matrix::ErrDimensionMismatch) end diff --git a/spec/ruby/library/matrix/shared/inverse.rb b/spec/ruby/library/matrix/shared/inverse.rb index e1e5ae5758..c8a6b90da5 100644 --- a/spec/ruby/library/matrix/shared/inverse.rb +++ b/spec/ruby/library/matrix/shared/inverse.rb @@ -25,7 +25,7 @@ describe :inverse, shared: true do end it "raises a ErrDimensionMismatch if the Matrix is not square" do - lambda{ + ->{ Matrix[ [1,2,3], [1,2,3] ].send(@method) }.should raise_error(Matrix::ErrDimensionMismatch) end diff --git a/spec/ruby/library/matrix/shared/trace.rb b/spec/ruby/library/matrix/shared/trace.rb index 2a42839f5d..57b89863f8 100644 --- a/spec/ruby/library/matrix/shared/trace.rb +++ b/spec/ruby/library/matrix/shared/trace.rb @@ -6,7 +6,7 @@ describe :trace, shared: true do end it "returns the sum of diagonal elements in a rectangular Matrix" do - lambda{ Matrix[[1,2,3], [4,5,6]].trace}.should raise_error(Matrix::ErrDimensionMismatch) + ->{ Matrix[[1,2,3], [4,5,6]].trace}.should raise_error(Matrix::ErrDimensionMismatch) end end diff --git a/spec/ruby/library/matrix/singular_spec.rb b/spec/ruby/library/matrix/singular_spec.rb index 362f4cbb35..7bba36a54a 100644 --- a/spec/ruby/library/matrix/singular_spec.rb +++ b/spec/ruby/library/matrix/singular_spec.rb @@ -19,11 +19,11 @@ describe "Matrix#singular?" do end it "raises an error for rectangular matrices" do - lambda { + -> { Matrix[[1], [2], [3]].singular? }.should raise_error(Matrix::ErrDimensionMismatch) - lambda { + -> { Matrix.empty(3,0).singular? }.should raise_error(Matrix::ErrDimensionMismatch) end diff --git a/spec/ruby/library/matrix/symmetric_spec.rb b/spec/ruby/library/matrix/symmetric_spec.rb index 7b7bce29fc..6f2a99276a 100644 --- a/spec/ruby/library/matrix/symmetric_spec.rb +++ b/spec/ruby/library/matrix/symmetric_spec.rb @@ -21,7 +21,7 @@ describe "Matrix.symmetric?" do Matrix.empty(0, 2), Matrix.empty(2, 0), ].each do |rectangular_matrix| - lambda { + -> { rectangular_matrix.symmetric? }.should raise_error(Matrix::ErrDimensionMismatch) end diff --git a/spec/ruby/library/matrix/unitary_spec.rb b/spec/ruby/library/matrix/unitary_spec.rb index 921ea3dda3..9c2a106ea5 100644 --- a/spec/ruby/library/matrix/unitary_spec.rb +++ b/spec/ruby/library/matrix/unitary_spec.rb @@ -20,7 +20,7 @@ describe "Matrix.unitary?" do Matrix.empty(0, 2), Matrix.empty(2, 0), ].each do |rectangular_matrix| - lambda { + -> { rectangular_matrix.unitary? }.should raise_error(Matrix::ErrDimensionMismatch) end diff --git a/spec/ruby/library/matrix/vector/cross_product_spec.rb b/spec/ruby/library/matrix/vector/cross_product_spec.rb index 5194782edd..c2698ade4c 100644 --- a/spec/ruby/library/matrix/vector/cross_product_spec.rb +++ b/spec/ruby/library/matrix/vector/cross_product_spec.rb @@ -7,7 +7,7 @@ describe "Vector#cross_product" do end it "raises an error unless both vectors have dimension 3" do - lambda { + -> { Vector[1, 2, 3].cross_product(Vector[0, -4]) }.should raise_error(Vector::ErrDimensionMismatch) end diff --git a/spec/ruby/library/matrix/vector/each2_spec.rb b/spec/ruby/library/matrix/vector/each2_spec.rb index 844b903336..10d2fc404d 100644 --- a/spec/ruby/library/matrix/vector/each2_spec.rb +++ b/spec/ruby/library/matrix/vector/each2_spec.rb @@ -8,8 +8,8 @@ describe "Vector.each2" do end it "requires one argument" do - lambda { @v.each2(@v2, @v2){} }.should raise_error(ArgumentError) - lambda { @v.each2(){} }.should raise_error(ArgumentError) + -> { @v.each2(@v2, @v2){} }.should raise_error(ArgumentError) + -> { @v.each2(){} }.should raise_error(ArgumentError) end describe "given one argument" do @@ -20,8 +20,8 @@ describe "Vector.each2" do end it "raises a DimensionMismatch error if the Vector size is different" do - lambda { @v.each2(Vector[1,2]){} }.should raise_error(Vector::ErrDimensionMismatch) - lambda { @v.each2(Vector[1,2,3,4]){} }.should raise_error(Vector::ErrDimensionMismatch) + -> { @v.each2(Vector[1,2]){} }.should raise_error(Vector::ErrDimensionMismatch) + -> { @v.each2(Vector[1,2,3,4]){} }.should raise_error(Vector::ErrDimensionMismatch) end it "yields arguments in sequence" do diff --git a/spec/ruby/library/matrix/vector/inner_product_spec.rb b/spec/ruby/library/matrix/vector/inner_product_spec.rb index 584226c450..1cf8771e04 100644 --- a/spec/ruby/library/matrix/vector/inner_product_spec.rb +++ b/spec/ruby/library/matrix/vector/inner_product_spec.rb @@ -11,7 +11,7 @@ describe "Vector#inner_product" do end it "raises an error for mismatched vectors" do - lambda { + -> { Vector[1, 2, 3].inner_product(Vector[0, -4]) }.should raise_error(Vector::ErrDimensionMismatch) end diff --git a/spec/ruby/library/matrix/vector/normalize_spec.rb b/spec/ruby/library/matrix/vector/normalize_spec.rb index 4ff9597c82..527c9260de 100644 --- a/spec/ruby/library/matrix/vector/normalize_spec.rb +++ b/spec/ruby/library/matrix/vector/normalize_spec.rb @@ -8,10 +8,10 @@ describe "Vector#normalize" do end it "raises an error for zero vectors" do - lambda { + -> { Vector[].normalize }.should raise_error(Vector::ZeroVectorError) - lambda { + -> { Vector[0, 0, 0].normalize }.should raise_error(Vector::ZeroVectorError) end diff --git a/spec/ruby/library/net/ftp/abort_spec.rb b/spec/ruby/library/net/ftp/abort_spec.rb index ff2144a3a0..57651468d8 100644 --- a/spec/ruby/library/net/ftp/abort_spec.rb +++ b/spec/ruby/library/net/ftp/abort_spec.rb @@ -18,7 +18,7 @@ describe "Net::FTP#abort" do end it "sends the ABOR command to the server" do - lambda { @ftp.abort }.should_not raise_error + -> { @ftp.abort }.should_not raise_error end it "ignores the response" do @@ -32,31 +32,31 @@ describe "Net::FTP#abort" do it "does not raise any error when the response code is 225" do @server.should_receive(:abor).and_respond("225 Data connection open; no transfer in progress.") - lambda { @ftp.abort }.should_not raise_error + -> { @ftp.abort }.should_not raise_error end it "does not raise any error when the response code is 226" do @server.should_receive(:abor).and_respond("226 Closing data connection.") - lambda { @ftp.abort }.should_not raise_error + -> { @ftp.abort }.should_not raise_error end it "raises a Net::FTPProtoError when the response code is 500" do @server.should_receive(:abor).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.abort }.should raise_error(Net::FTPProtoError) + -> { @ftp.abort }.should raise_error(Net::FTPProtoError) end it "raises a Net::FTPProtoError when the response code is 501" do @server.should_receive(:abor).and_respond("501 Syntax error in parameters or arguments.") - lambda { @ftp.abort }.should raise_error(Net::FTPProtoError) + -> { @ftp.abort }.should raise_error(Net::FTPProtoError) end it "raises a Net::FTPProtoError when the response code is 502" do @server.should_receive(:abor).and_respond("502 Command not implemented.") - lambda { @ftp.abort }.should raise_error(Net::FTPProtoError) + -> { @ftp.abort }.should raise_error(Net::FTPProtoError) end it "raises a Net::FTPProtoError when the response code is 421" do @server.should_receive(:abor).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.abort }.should raise_error(Net::FTPProtoError) + -> { @ftp.abort }.should raise_error(Net::FTPProtoError) end end diff --git a/spec/ruby/library/net/ftp/acct_spec.rb b/spec/ruby/library/net/ftp/acct_spec.rb index 3db51fca0f..d8068dc81e 100644 --- a/spec/ruby/library/net/ftp/acct_spec.rb +++ b/spec/ruby/library/net/ftp/acct_spec.rb @@ -28,31 +28,31 @@ describe "Net::FTP#acct" do it "does not raise any error when the response code is 230" do @server.should_receive(:acct).and_respond("230 User logged in, proceed.") - lambda { @ftp.acct("my_account") }.should_not raise_error + -> { @ftp.acct("my_account") }.should_not raise_error end it "raises a Net::FTPPermError when the response code is 530" do @server.should_receive(:acct).and_respond("530 Not logged in.") - lambda { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError) + -> { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 500" do @server.should_receive(:acct).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError) + -> { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:acct).and_respond("501 Syntax error in parameters or arguments.") - lambda { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError) + -> { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 503" do @server.should_receive(:acct).and_respond("503 Bad sequence of commands.") - lambda { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError) + -> { @ftp.acct("my_account") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:acct).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.acct("my_account") }.should raise_error(Net::FTPTempError) + -> { @ftp.acct("my_account") }.should raise_error(Net::FTPTempError) end end diff --git a/spec/ruby/library/net/ftp/chdir_spec.rb b/spec/ruby/library/net/ftp/chdir_spec.rb index 1f558c47e8..4c10fa78b4 100644 --- a/spec/ruby/library/net/ftp/chdir_spec.rb +++ b/spec/ruby/library/net/ftp/chdir_spec.rb @@ -29,32 +29,32 @@ describe "Net::FTP#chdir" do it "does not raise a Net::FTPPermError when the response code is 500" do @server.should_receive(:cdup).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.chdir("..") }.should_not raise_error(Net::FTPPermError) + -> { @ftp.chdir("..") }.should_not raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:cdup).and_respond("501 Syntax error in parameters or arguments.") - lambda { @ftp.chdir("..") }.should raise_error(Net::FTPPermError) + -> { @ftp.chdir("..") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 502" do @server.should_receive(:cdup).and_respond("502 Command not implemented.") - lambda { @ftp.chdir("..") }.should raise_error(Net::FTPPermError) + -> { @ftp.chdir("..") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:cdup).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.chdir("..") }.should raise_error(Net::FTPTempError) + -> { @ftp.chdir("..") }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 530" do @server.should_receive(:cdup).and_respond("530 Not logged in.") - lambda { @ftp.chdir("..") }.should raise_error(Net::FTPPermError) + -> { @ftp.chdir("..") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 550" do @server.should_receive(:cdup).and_respond("550 Requested action not taken.") - lambda { @ftp.chdir("..") }.should raise_error(Net::FTPPermError) + -> { @ftp.chdir("..") }.should raise_error(Net::FTPPermError) end end @@ -69,31 +69,31 @@ describe "Net::FTP#chdir" do it "raises a Net::FTPPermError when the response code is 500" do @server.should_receive(:cwd).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.chdir("test") }.should raise_error(Net::FTPPermError) + -> { @ftp.chdir("test") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:cwd).and_respond("501 Syntax error in parameters or arguments.") - lambda { @ftp.chdir("test") }.should raise_error(Net::FTPPermError) + -> { @ftp.chdir("test") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 502" do @server.should_receive(:cwd).and_respond("502 Command not implemented.") - lambda { @ftp.chdir("test") }.should raise_error(Net::FTPPermError) + -> { @ftp.chdir("test") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:cwd).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.chdir("test") }.should raise_error(Net::FTPTempError) + -> { @ftp.chdir("test") }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 530" do @server.should_receive(:cwd).and_respond("530 Not logged in.") - lambda { @ftp.chdir("test") }.should raise_error(Net::FTPPermError) + -> { @ftp.chdir("test") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 550" do @server.should_receive(:cwd).and_respond("550 Requested action not taken.") - lambda { @ftp.chdir("test") }.should raise_error(Net::FTPPermError) + -> { @ftp.chdir("test") }.should raise_error(Net::FTPPermError) end end diff --git a/spec/ruby/library/net/ftp/connect_spec.rb b/spec/ruby/library/net/ftp/connect_spec.rb index 981751233e..9ee9bcd2c6 100644 --- a/spec/ruby/library/net/ftp/connect_spec.rb +++ b/spec/ruby/library/net/ftp/connect_spec.rb @@ -19,7 +19,7 @@ describe "Net::FTP#connect" do end it "tries to connect to the FTP Server on the given host and port" do - lambda { @ftp.connect(@server.hostname, @server.server_port) }.should_not raise_error + -> { @ftp.connect(@server.hostname, @server.server_port) }.should_not raise_error end it "returns nil" do @@ -28,22 +28,22 @@ describe "Net::FTP#connect" do it "prints a small debug line when in debug mode" do @ftp.debug_mode = true - lambda { @ftp.connect(@server.hostname, @server.server_port) }.should output(/#{"connect: "}#{@server.hostname}#{", "}#{@server.server_port}#{"\\nget: 220 Dummy FTP Server ready!"}/) + -> { @ftp.connect(@server.hostname, @server.server_port) }.should output(/#{"connect: "}#{@server.hostname}#{", "}#{@server.server_port}#{"\\nget: 220 Dummy FTP Server ready!"}/) @ftp.debug_mode = false end it "does not raise any error when the response code is 220" do @server.connect_message = "220 Dummy FTP Server ready!" - lambda { @ftp.connect(@server.hostname, @server.server_port) }.should_not raise_error + -> { @ftp.connect(@server.hostname, @server.server_port) }.should_not raise_error end it "raises a Net::FTPReplyError when the response code is 120" do @server.connect_message = "120 Service ready in nnn minutes." - lambda { @ftp.connect(@server.hostname, @server.server_port) }.should raise_error(Net::FTPReplyError) + -> { @ftp.connect(@server.hostname, @server.server_port) }.should raise_error(Net::FTPReplyError) end it "raises a Net::FTPTempError when the response code is 421" do @server.connect_message = "421 Service not available, closing control connection." - lambda { @ftp.connect(@server.hostname, @server.server_port) }.should raise_error(Net::FTPTempError) + -> { @ftp.connect(@server.hostname, @server.server_port) }.should raise_error(Net::FTPTempError) end end diff --git a/spec/ruby/library/net/ftp/delete_spec.rb b/spec/ruby/library/net/ftp/delete_spec.rb index fa0eddb312..cf8f9332e2 100644 --- a/spec/ruby/library/net/ftp/delete_spec.rb +++ b/spec/ruby/library/net/ftp/delete_spec.rb @@ -24,36 +24,36 @@ describe "Net::FTP#delete" do it "raises a Net::FTPTempError when the response code is 450" do @server.should_receive(:dele).and_respond("450 Requested file action not taken.") - lambda { @ftp.delete("test.file") }.should raise_error(Net::FTPTempError) + -> { @ftp.delete("test.file") }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 550" do @server.should_receive(:dele).and_respond("550 Requested action not taken.") - lambda { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError) + -> { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 500" do @server.should_receive(:dele).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError) + -> { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:dele).and_respond("501 Syntax error in parameters or arguments.") - lambda { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError) + -> { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 502" do @server.should_receive(:dele).and_respond("502 Command not implemented.") - lambda { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError) + -> { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:dele).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.delete("test.file") }.should raise_error(Net::FTPTempError) + -> { @ftp.delete("test.file") }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 530" do @server.should_receive(:dele).and_respond("530 Not logged in.") - lambda { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError) + -> { @ftp.delete("test.file") }.should raise_error(Net::FTPPermError) end end diff --git a/spec/ruby/library/net/ftp/fixtures/server.rb b/spec/ruby/library/net/ftp/fixtures/server.rb index 65339cfaf9..d4795a5c58 100644 --- a/spec/ruby/library/net/ftp/fixtures/server.rb +++ b/spec/ruby/library/net/ftp/fixtures/server.rb @@ -86,7 +86,7 @@ module NetFTPSpecs end def and_respond(text) - @handlers[@handler_for] = lambda { |s, *args| s.response(text) } + @handlers[@handler_for] = -> s, *args { s.response(text) } end ## diff --git a/spec/ruby/library/net/ftp/help_spec.rb b/spec/ruby/library/net/ftp/help_spec.rb index c7a089a588..d2e9fe7ee8 100644 --- a/spec/ruby/library/net/ftp/help_spec.rb +++ b/spec/ruby/library/net/ftp/help_spec.rb @@ -36,31 +36,31 @@ describe "Net::FTP#help" do it "does not raise any error when the response code is 211" do @server.should_receive(:help).and_respond("211 System status, or system help reply.") - lambda { @ftp.help }.should_not raise_error + -> { @ftp.help }.should_not raise_error end it "does not raise any error when the response code is 214" do @server.should_receive(:help).and_respond("214 Help message.") - lambda { @ftp.help }.should_not raise_error + -> { @ftp.help }.should_not raise_error end it "raises a Net::FTPPermError when the response code is 500" do @server.should_receive(:help).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.help }.should raise_error(Net::FTPPermError) + -> { @ftp.help }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:help).and_respond("501 Syntax error in parameters or arguments.") - lambda { @ftp.help }.should raise_error(Net::FTPPermError) + -> { @ftp.help }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 502" do @server.should_receive(:help).and_respond("502 Command not implemented.") - lambda { @ftp.help }.should raise_error(Net::FTPPermError) + -> { @ftp.help }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:help).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.help }.should raise_error(Net::FTPTempError) + -> { @ftp.help }.should raise_error(Net::FTPTempError) end end diff --git a/spec/ruby/library/net/ftp/login_spec.rb b/spec/ruby/library/net/ftp/login_spec.rb index c4f14f8747..46736851ee 100644 --- a/spec/ruby/library/net/ftp/login_spec.rb +++ b/spec/ruby/library/net/ftp/login_spec.rb @@ -32,7 +32,7 @@ describe "Net::FTP#login" do it "raises a Net::FTPReplyError when the server requests an account" do @server.should_receive(:user).and_respond("331 User name okay, need password.") @server.should_receive(:pass).and_respond("332 Need account for login.") - lambda { @ftp.login }.should raise_error(Net::FTPReplyError) + -> { @ftp.login }.should raise_error(Net::FTPReplyError) end end @@ -44,13 +44,13 @@ describe "Net::FTP#login" do it "raises a Net::FTPReplyError when the server requests a password, but none was given" do @server.should_receive(:user).and_respond("331 User name okay, need password.") - lambda { @ftp.login("rubyspec") }.should raise_error(Net::FTPReplyError) + -> { @ftp.login("rubyspec") }.should raise_error(Net::FTPReplyError) end it "raises a Net::FTPReplyError when the server requests an account, but none was given" do @server.should_receive(:user).and_respond("331 User name okay, need password.") @server.should_receive(:pass).and_respond("332 Need account for login.") - lambda { @ftp.login("rubyspec") }.should raise_error(Net::FTPReplyError) + -> { @ftp.login("rubyspec") }.should raise_error(Net::FTPReplyError) end end @@ -69,7 +69,7 @@ describe "Net::FTP#login" do it "raises a Net::FTPReplyError when the server requests an account" do @server.should_receive(:user).and_respond("331 User name okay, need password.") @server.should_receive(:pass).and_respond("332 Need account for login.") - lambda { @ftp.login("rubyspec", "rocks") }.should raise_error(Net::FTPReplyError) + -> { @ftp.login("rubyspec", "rocks") }.should raise_error(Net::FTPReplyError) end end @@ -96,27 +96,27 @@ describe "Net::FTP#login" do describe "when the USER command fails" do it "raises a Net::FTPPermError when the response code is 500" do @server.should_receive(:user).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError) + -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:user).and_respond("501 Syntax error in parameters or arguments.") - lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError) + -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 502" do @server.should_receive(:user).and_respond("502 Command not implemented.") - lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError) + -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:user).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPTempError) + -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 530" do @server.should_receive(:user).and_respond("530 Not logged in.") - lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError) + -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError) end end @@ -127,32 +127,32 @@ describe "Net::FTP#login" do it "does not raise an Error when the response code is 202" do @server.should_receive(:pass).and_respond("202 Command not implemented, superfluous at this site.") - lambda { @ftp.login("rubyspec", "rocks", "account") }.should_not raise_error + -> { @ftp.login("rubyspec", "rocks", "account") }.should_not raise_error end it "raises a Net::FTPPermError when the response code is 500" do @server.should_receive(:pass).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError) + -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:pass).and_respond("501 Syntax error in parameters or arguments.") - lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError) + -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 502" do @server.should_receive(:pass).and_respond("502 Command not implemented.") - lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError) + -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:pass).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPTempError) + -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 530" do @server.should_receive(:pass).and_respond("530 Not logged in.") - lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError) + -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError) end end @@ -164,32 +164,32 @@ describe "Net::FTP#login" do it "does not raise an Error when the response code is 202" do @server.should_receive(:acct).and_respond("202 Command not implemented, superfluous at this site.") - lambda { @ftp.login("rubyspec", "rocks", "account") }.should_not raise_error + -> { @ftp.login("rubyspec", "rocks", "account") }.should_not raise_error end it "raises a Net::FTPPermError when the response code is 500" do @server.should_receive(:acct).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError) + -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:acct).and_respond("501 Syntax error in parameters or arguments.") - lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError) + -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 502" do @server.should_receive(:acct).and_respond("502 Command not implemented.") - lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError) + -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:acct).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPTempError) + -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 530" do @server.should_receive(:acct).and_respond("530 Not logged in.") - lambda { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError) + -> { @ftp.login("rubyspec", "rocks", "account") }.should raise_error(Net::FTPPermError) end end end diff --git a/spec/ruby/library/net/ftp/mdtm_spec.rb b/spec/ruby/library/net/ftp/mdtm_spec.rb index ddcc06d708..b74cf8d3c7 100644 --- a/spec/ruby/library/net/ftp/mdtm_spec.rb +++ b/spec/ruby/library/net/ftp/mdtm_spec.rb @@ -28,11 +28,11 @@ describe "Net::FTP#mdtm" do it "raises a Net::FTPPermError when the response code is 550" do @server.should_receive(:mdtm).and_respond("550 Requested action not taken.") - lambda { @ftp.mdtm("test.file") }.should raise_error(Net::FTPPermError) + -> { @ftp.mdtm("test.file") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:mdtm).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.mdtm("test.file") }.should raise_error(Net::FTPTempError) + -> { @ftp.mdtm("test.file") }.should raise_error(Net::FTPTempError) end end diff --git a/spec/ruby/library/net/ftp/mkdir_spec.rb b/spec/ruby/library/net/ftp/mkdir_spec.rb index 0d8314bfa3..7dc45b5711 100644 --- a/spec/ruby/library/net/ftp/mkdir_spec.rb +++ b/spec/ruby/library/net/ftp/mkdir_spec.rb @@ -31,31 +31,31 @@ describe "Net::FTP#mkdir" do it "raises a Net::FTPPermError when the response code is 500" do @server.should_receive(:mkd).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError) + -> { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:mkd).and_respond("501 Syntax error in parameters or arguments.") - lambda { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError) + -> { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 502" do @server.should_receive(:mkd).and_respond("502 Command not implemented.") - lambda { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError) + -> { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:mkd).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPTempError) + -> { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 530" do @server.should_receive(:mkd).and_respond("530 Not logged in.") - lambda { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError) + -> { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 550" do @server.should_receive(:mkd).and_respond("550 Requested action not taken.") - lambda { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError) + -> { @ftp.mkdir("test.folder") }.should raise_error(Net::FTPPermError) end end diff --git a/spec/ruby/library/net/ftp/mtime_spec.rb b/spec/ruby/library/net/ftp/mtime_spec.rb index e05e92f58f..0f6cc1ba20 100644 --- a/spec/ruby/library/net/ftp/mtime_spec.rb +++ b/spec/ruby/library/net/ftp/mtime_spec.rb @@ -40,11 +40,11 @@ describe "Net::FTP#mtime" do it "raises a Net::FTPPermError when the response code is 550" do @server.should_receive(:mdtm).and_respond("550 Requested action not taken.") - lambda { @ftp.mtime("test.file") }.should raise_error(Net::FTPPermError) + -> { @ftp.mtime("test.file") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:mdtm).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.mtime("test.file") }.should raise_error(Net::FTPTempError) + -> { @ftp.mtime("test.file") }.should raise_error(Net::FTPTempError) end end diff --git a/spec/ruby/library/net/ftp/nlst_spec.rb b/spec/ruby/library/net/ftp/nlst_spec.rb index 36ca7a6127..34384fb8c4 100644 --- a/spec/ruby/library/net/ftp/nlst_spec.rb +++ b/spec/ruby/library/net/ftp/nlst_spec.rb @@ -35,32 +35,32 @@ describe "Net::FTP#nlst" do describe "when the NLST command fails" do it "raises a Net::FTPTempError when the response code is 450" do @server.should_receive(:nlst).and_respond("450 Requested file action not taken..") - lambda { @ftp.nlst }.should raise_error(Net::FTPTempError) + -> { @ftp.nlst }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 500" do @server.should_receive(:nlst).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.nlst }.should raise_error(Net::FTPPermError) + -> { @ftp.nlst }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:nlst).and_respond("501 Syntax error, command unrecognized.") - lambda { @ftp.nlst }.should raise_error(Net::FTPPermError) + -> { @ftp.nlst }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 502" do @server.should_receive(:nlst).and_respond("502 Command not implemented.") - lambda { @ftp.nlst }.should raise_error(Net::FTPPermError) + -> { @ftp.nlst }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:nlst).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.nlst }.should raise_error(Net::FTPTempError) + -> { @ftp.nlst }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 530" do @server.should_receive(:nlst).and_respond("530 Not logged in.") - lambda { @ftp.nlst }.should raise_error(Net::FTPPermError) + -> { @ftp.nlst }.should raise_error(Net::FTPPermError) end end @@ -68,25 +68,25 @@ describe "Net::FTP#nlst" do it "raises a Net::FTPPermError when the response code is 500" do @server.should_receive(:eprt).and_respond("500 Syntax error, command unrecognized.") @server.should_receive(:port).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.nlst }.should raise_error(Net::FTPPermError) + -> { @ftp.nlst }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:eprt).and_respond("501 Syntax error in parameters or arguments.") @server.should_receive(:port).and_respond("501 Syntax error in parameters or arguments.") - lambda { @ftp.nlst }.should raise_error(Net::FTPPermError) + -> { @ftp.nlst }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:eprt).and_respond("421 Service not available, closing control connection.") @server.should_receive(:port).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.nlst }.should raise_error(Net::FTPTempError) + -> { @ftp.nlst }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 530" do @server.should_receive(:eprt).and_respond("530 Not logged in.") @server.should_receive(:port).and_respond("530 Not logged in.") - lambda { @ftp.nlst }.should raise_error(Net::FTPPermError) + -> { @ftp.nlst }.should raise_error(Net::FTPPermError) end end end diff --git a/spec/ruby/library/net/ftp/noop_spec.rb b/spec/ruby/library/net/ftp/noop_spec.rb index eca8911b7b..070750ced7 100644 --- a/spec/ruby/library/net/ftp/noop_spec.rb +++ b/spec/ruby/library/net/ftp/noop_spec.rb @@ -28,11 +28,11 @@ describe "Net::FTP#noop" do it "raises a Net::FTPPermError when the response code is 500" do @server.should_receive(:noop).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.noop }.should raise_error(Net::FTPPermError) + -> { @ftp.noop }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:noop).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.noop }.should raise_error(Net::FTPTempError) + -> { @ftp.noop }.should raise_error(Net::FTPTempError) end end diff --git a/spec/ruby/library/net/ftp/pwd_spec.rb b/spec/ruby/library/net/ftp/pwd_spec.rb index f515cd29a0..a3998cc730 100644 --- a/spec/ruby/library/net/ftp/pwd_spec.rb +++ b/spec/ruby/library/net/ftp/pwd_spec.rb @@ -28,26 +28,26 @@ describe "Net::FTP#pwd" do it "raises a Net::FTPPermError when the response code is 500" do @server.should_receive(:pwd).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.pwd }.should raise_error(Net::FTPPermError) + -> { @ftp.pwd }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:pwd).and_respond("501 Syntax error in parameters or arguments.") - lambda { @ftp.pwd }.should raise_error(Net::FTPPermError) + -> { @ftp.pwd }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 502" do @server.should_receive(:pwd).and_respond("502 Command not implemented.") - lambda { @ftp.pwd }.should raise_error(Net::FTPPermError) + -> { @ftp.pwd }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:pwd).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.pwd }.should raise_error(Net::FTPTempError) + -> { @ftp.pwd }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 550" do @server.should_receive(:pwd).and_respond("550 Requested action not taken.") - lambda { @ftp.pwd }.should raise_error(Net::FTPPermError) + -> { @ftp.pwd }.should raise_error(Net::FTPPermError) end end diff --git a/spec/ruby/library/net/ftp/rename_spec.rb b/spec/ruby/library/net/ftp/rename_spec.rb index e1fd4e47cf..376b203ac9 100644 --- a/spec/ruby/library/net/ftp/rename_spec.rb +++ b/spec/ruby/library/net/ftp/rename_spec.rb @@ -31,64 +31,64 @@ describe "Net::FTP#rename" do describe "when the RNFR command fails" do it "raises a Net::FTPTempError when the response code is 450" do @server.should_receive(:rnfr).and_respond("450 Requested file action not taken.") - lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPTempError) + -> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 550" do @server.should_receive(:rnfr).and_respond("550 Requested action not taken.") - lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError) + -> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:rnfr).and_respond("501 Syntax error in parameters or arguments.") - lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError) + -> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 502" do @server.should_receive(:rnfr).and_respond("502 Command not implemented.") - lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError) + -> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:rnfr).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPTempError) + -> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 530" do @server.should_receive(:rnfr).and_respond("530 Not logged in.") - lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError) + -> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError) end end describe "when the RNTO command fails" do it "raises a Net::FTPPermError when the response code is 532" do @server.should_receive(:rnfr).and_respond("532 Need account for storing files.") - lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError) + -> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 553" do @server.should_receive(:rnto).and_respond("553 Requested action not taken.") - lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError) + -> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:rnto).and_respond("501 Syntax error in parameters or arguments.") - lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError) + -> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 502" do @server.should_receive(:rnto).and_respond("502 Command not implemented.") - lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError) + -> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:rnto).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPTempError) + -> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 530" do @server.should_receive(:rnto).and_respond("530 Not logged in.") - lambda { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError) + -> { @ftp.rename("from.file", "to.file") }.should raise_error(Net::FTPPermError) end end end diff --git a/spec/ruby/library/net/ftp/return_code_spec.rb b/spec/ruby/library/net/ftp/return_code_spec.rb index 605f66ec6e..e4b98c8031 100644 --- a/spec/ruby/library/net/ftp/return_code_spec.rb +++ b/spec/ruby/library/net/ftp/return_code_spec.rb @@ -7,7 +7,7 @@ describe "Net::FTP#return_code" do end it "outputs a warning and returns a newline" do - lambda do + -> do @ftp.return_code.should == "\n" end.should complain(/warning: Net::FTP#return_code is obsolete and do nothing/) end @@ -19,6 +19,6 @@ describe "Net::FTP#return_code=" do end it "outputs a warning" do - lambda { @ftp.return_code = 123 }.should complain(/warning: Net::FTP#return_code= is obsolete and do nothing/) + -> { @ftp.return_code = 123 }.should complain(/warning: Net::FTP#return_code= is obsolete and do nothing/) end end diff --git a/spec/ruby/library/net/ftp/rmdir_spec.rb b/spec/ruby/library/net/ftp/rmdir_spec.rb index ab92a8678b..0515897998 100644 --- a/spec/ruby/library/net/ftp/rmdir_spec.rb +++ b/spec/ruby/library/net/ftp/rmdir_spec.rb @@ -28,31 +28,31 @@ describe "Net::FTP#rmdir" do it "raises a Net::FTPPermError when the response code is 500" do @server.should_receive(:rmd).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError) + -> { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:rmd).and_respond("501 Syntax error in parameters or arguments.") - lambda { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError) + -> { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 502" do @server.should_receive(:rmd).and_respond("502 Command not implemented.") - lambda { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError) + -> { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:rmd).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPTempError) + -> { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 530" do @server.should_receive(:rmd).and_respond("530 Not logged in.") - lambda { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError) + -> { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 550" do @server.should_receive(:rmd).and_respond("550 Requested action not taken.") - lambda { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError) + -> { @ftp.rmdir("test.folder") }.should raise_error(Net::FTPPermError) end end diff --git a/spec/ruby/library/net/ftp/sendcmd_spec.rb b/spec/ruby/library/net/ftp/sendcmd_spec.rb index 631bc10c84..dafa36e032 100644 --- a/spec/ruby/library/net/ftp/sendcmd_spec.rb +++ b/spec/ruby/library/net/ftp/sendcmd_spec.rb @@ -28,27 +28,27 @@ describe "Net::FTP#sendcmd" do it "raises no error when the response code is 1xx, 2xx or 3xx" do @server.should_receive(:help).and_respond("120 Service ready in nnn minutes.") - lambda { @ftp.sendcmd("HELP") }.should_not raise_error + -> { @ftp.sendcmd("HELP") }.should_not raise_error @server.should_receive(:help).and_respond("200 Command okay.") - lambda { @ftp.sendcmd("HELP") }.should_not raise_error + -> { @ftp.sendcmd("HELP") }.should_not raise_error @server.should_receive(:help).and_respond("350 Requested file action pending further information.") - lambda { @ftp.sendcmd("HELP") }.should_not raise_error + -> { @ftp.sendcmd("HELP") }.should_not raise_error end it "raises a Net::FTPTempError when the response code is 4xx" do @server.should_receive(:help).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.sendcmd("HELP") }.should raise_error(Net::FTPTempError) + -> { @ftp.sendcmd("HELP") }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 5xx" do @server.should_receive(:help).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.sendcmd("HELP") }.should raise_error(Net::FTPPermError) + -> { @ftp.sendcmd("HELP") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPProtoError when the response code is not between 1xx-5xx" do @server.should_receive(:help).and_respond("999 Invalid response.") - lambda { @ftp.sendcmd("HELP") }.should raise_error(Net::FTPProtoError) + -> { @ftp.sendcmd("HELP") }.should raise_error(Net::FTPProtoError) end end diff --git a/spec/ruby/library/net/ftp/shared/getbinaryfile.rb b/spec/ruby/library/net/ftp/shared/getbinaryfile.rb index 2252935b2d..f324f5b85d 100644 --- a/spec/ruby/library/net/ftp/shared/getbinaryfile.rb +++ b/spec/ruby/library/net/ftp/shared/getbinaryfile.rb @@ -60,32 +60,32 @@ describe :net_ftp_getbinaryfile, shared: :true do describe "and the REST command fails" do it "raises a Net::FTPProtoError when the response code is 550" do @server.should_receive(:rest).and_respond("Requested action not taken.") - lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPProtoError) + -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPProtoError) end it "raises a Net::FTPPermError when the response code is 500" do @server.should_receive(:rest).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:rest).and_respond("501 Syntax error, command unrecognized.") - lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 502" do @server.should_receive(:rest).and_respond("502 Command not implemented.") - lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:rest).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError) + -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 530" do @server.should_receive(:rest).and_respond("530 Not logged in.") - lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) end end end @@ -93,32 +93,32 @@ describe :net_ftp_getbinaryfile, shared: :true do describe "when the RETR command fails" do it "raises a Net::FTPTempError when the response code is 450" do @server.should_receive(:retr).and_respond("450 Requested file action not taken.") - lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError) + -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPProtoError when the response code is 550" do @server.should_receive(:retr).and_respond("Requested action not taken.") - lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPProtoError) + -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPProtoError) end it "raises a Net::FTPPermError when the response code is 500" do @server.should_receive(:retr).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:retr).and_respond("501 Syntax error, command unrecognized.") - lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:retr).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError) + -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 530" do @server.should_receive(:retr).and_respond("530 Not logged in.") - lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) end end @@ -126,25 +126,25 @@ describe :net_ftp_getbinaryfile, shared: :true do it "raises a Net::FTPPermError when the response code is 500" do @server.should_receive(:eprt).and_respond("500 Syntax error, command unrecognized.") @server.should_receive(:port).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:eprt).and_respond("501 Syntax error in parameters or arguments.") @server.should_receive(:port).and_respond("501 Syntax error in parameters or arguments.") - lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:eprt).and_respond("421 Service not available, closing control connection.") @server.should_receive(:port).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError) + -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 530" do @server.should_receive(:eprt).and_respond("530 Not logged in.") @server.should_receive(:port).and_respond("530 Not logged in.") - lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) end end end diff --git a/spec/ruby/library/net/ftp/shared/gettextfile.rb b/spec/ruby/library/net/ftp/shared/gettextfile.rb index 6219581d12..82bec2a4a7 100644 --- a/spec/ruby/library/net/ftp/shared/gettextfile.rb +++ b/spec/ruby/library/net/ftp/shared/gettextfile.rb @@ -43,32 +43,32 @@ describe :net_ftp_gettextfile, shared: :true do describe "when the RETR command fails" do it "raises a Net::FTPTempError when the response code is 450" do @server.should_receive(:retr).and_respond("450 Requested file action not taken.") - lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError) + -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPProtoError when the response code is 550" do @server.should_receive(:retr).and_respond("Requested action not taken.") - lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPProtoError) + -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPProtoError) end it "raises a Net::FTPPermError when the response code is 500" do @server.should_receive(:retr).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:retr).and_respond("501 Syntax error, command unrecognized.") - lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:retr).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError) + -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 530" do @server.should_receive(:retr).and_respond("530 Not logged in.") - lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) end end @@ -76,25 +76,25 @@ describe :net_ftp_gettextfile, shared: :true do it "raises a Net::FTPPermError when the response code is 500" do @server.should_receive(:eprt).and_respond("500 Syntax error, command unrecognized.") @server.should_receive(:port).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:eprt).and_respond("501 Syntax error in parameters or arguments.") @server.should_receive(:port).and_respond("501 Syntax error in parameters or arguments.") - lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:eprt).and_respond("421 Service not available, closing control connection.") @server.should_receive(:port).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError) + -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 530" do @server.should_receive(:eprt).and_respond("530 Not logged in.") @server.should_receive(:port).and_respond("530 Not logged in.") - lambda { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, "test", @tmp_file) }.should raise_error(Net::FTPPermError) end end end diff --git a/spec/ruby/library/net/ftp/shared/list.rb b/spec/ruby/library/net/ftp/shared/list.rb index 50ca8ad119..adc3fa59c1 100644 --- a/spec/ruby/library/net/ftp/shared/list.rb +++ b/spec/ruby/library/net/ftp/shared/list.rb @@ -47,32 +47,32 @@ describe :net_ftp_list, shared: true do describe "when the LIST command fails" do it "raises a Net::FTPTempError when the response code is 450" do @server.should_receive(:list).and_respond("450 Requested file action not taken..") - lambda { @ftp.send(@method) }.should raise_error(Net::FTPTempError) + -> { @ftp.send(@method) }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 500" do @server.should_receive(:list).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.send(@method) }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method) }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:list).and_respond("501 Syntax error, command unrecognized.") - lambda { @ftp.send(@method) }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method) }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 502" do @server.should_receive(:list).and_respond("502 Command not implemented.") - lambda { @ftp.send(@method) }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method) }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:list).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.send(@method) }.should raise_error(Net::FTPTempError) + -> { @ftp.send(@method) }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 530" do @server.should_receive(:list).and_respond("530 Not logged in.") - lambda { @ftp.send(@method) }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method) }.should raise_error(Net::FTPPermError) end end @@ -80,25 +80,25 @@ describe :net_ftp_list, shared: true do it "raises a Net::FTPPermError when the response code is 500" do @server.should_receive(:eprt).and_respond("500 Syntax error, command unrecognized.") @server.should_receive(:port).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.send(@method) }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method) }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:eprt).and_respond("501 Syntax error in parameters or arguments.") @server.should_receive(:port).and_respond("501 Syntax error in parameters or arguments.") - lambda { @ftp.send(@method) }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method) }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:eprt).and_respond("421 Service not available, closing control connection.") @server.should_receive(:port).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.send(@method) }.should raise_error(Net::FTPTempError) + -> { @ftp.send(@method) }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 530" do @server.should_receive(:eprt).and_respond("530 Not logged in.") @server.should_receive(:port).and_respond("530 Not logged in.") - lambda { @ftp.send(@method) }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method) }.should raise_error(Net::FTPPermError) end end end diff --git a/spec/ruby/library/net/ftp/shared/putbinaryfile.rb b/spec/ruby/library/net/ftp/shared/putbinaryfile.rb index 74eaf320ae..1163a1cfea 100644 --- a/spec/ruby/library/net/ftp/shared/putbinaryfile.rb +++ b/spec/ruby/library/net/ftp/shared/putbinaryfile.rb @@ -67,32 +67,32 @@ describe :net_ftp_putbinaryfile, shared: :true do describe "and the APPE command fails" do it "raises a Net::FTPProtoError when the response code is 550" do @server.should_receive(:appe).and_respond("Requested action not taken.") - lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPProtoError) + -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPProtoError) end it "raises a Net::FTPPermError when the response code is 500" do @server.should_receive(:appe).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:appe).and_respond("501 Syntax error, command unrecognized.") - lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 502" do @server.should_receive(:appe).and_respond("502 Command not implemented.") - lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:appe).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError) + -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 530" do @server.should_receive(:appe).and_respond("530 Not logged in.") - lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError) end end end @@ -100,42 +100,42 @@ describe :net_ftp_putbinaryfile, shared: :true do describe "when the STOR command fails" do it "raises a Net::FTPPermError when the response code is 532" do @server.should_receive(:stor).and_respond("532 Need account for storing files.") - lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 450" do @server.should_receive(:stor).and_respond("450 Requested file action not taken.") - lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError) + -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPTempError when the response code is 452" do @server.should_receive(:stor).and_respond("452 Requested action not taken.") - lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError) + -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 553" do @server.should_receive(:stor).and_respond("553 Requested action not taken.") - lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 500" do @server.should_receive(:stor).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:stor).and_respond("501 Syntax error in parameters or arguments.") - lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:stor).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError) + -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 530" do @server.should_receive(:stor).and_respond("530 Not logged in.") - lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError) end end @@ -143,25 +143,25 @@ describe :net_ftp_putbinaryfile, shared: :true do it "raises a Net::FTPPermError when the response code is 500" do @server.should_receive(:eprt).and_respond("500 Syntax error, command unrecognized.") @server.should_receive(:port).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:eprt).and_respond("501 Syntax error in parameters or arguments.") @server.should_receive(:port).and_respond("501 Syntax error in parameters or arguments.") - lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:eprt).and_respond("421 Service not available, closing control connection.") @server.should_receive(:port).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError) + -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 530" do @server.should_receive(:eprt).and_respond("530 Not logged in.") @server.should_receive(:port).and_respond("530 Not logged in.") - lambda { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, @local_fixture_file, "binary") }.should raise_error(Net::FTPPermError) end end end diff --git a/spec/ruby/library/net/ftp/shared/puttextfile.rb b/spec/ruby/library/net/ftp/shared/puttextfile.rb index 9bfdc7c41e..50e8de28e6 100644 --- a/spec/ruby/library/net/ftp/shared/puttextfile.rb +++ b/spec/ruby/library/net/ftp/shared/puttextfile.rb @@ -53,42 +53,42 @@ describe :net_ftp_puttextfile, shared: true do describe "when the STOR command fails" do it "raises a Net::FTPPermError when the response code is 532" do @server.should_receive(:stor).and_respond("532 Need account for storing files.") - lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 450" do @server.should_receive(:stor).and_respond("450 Requested file action not taken.") - lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPTempError) + -> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPTempError when the response code is 452" do @server.should_receive(:stor).and_respond("452 Requested action not taken.") - lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPTempError) + -> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 553" do @server.should_receive(:stor).and_respond("553 Requested action not taken.") - lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 500" do @server.should_receive(:stor).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:stor).and_respond("501 Syntax error in parameters or arguments.") - lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:stor).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPTempError) + -> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 530" do @server.should_receive(:stor).and_respond("530 Not logged in.") - lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError) end end @@ -96,25 +96,25 @@ describe :net_ftp_puttextfile, shared: true do it "raises a Net::FTPPermError when the response code is 500" do @server.should_receive(:eprt).and_respond("500 Syntax error, command unrecognized.") @server.should_receive(:port).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:eprt).and_respond("501 Syntax error in parameters or arguments.") @server.should_receive(:port).and_respond("501 Syntax error in parameters or arguments.") - lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:eprt).and_respond("421 Service not available, closing control connection.") @server.should_receive(:port).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPTempError) + -> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 530" do @server.should_receive(:eprt).and_respond("530 Not logged in.") @server.should_receive(:port).and_respond("530 Not logged in.") - lambda { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError) + -> { @ftp.send(@method, @local_fixture_file, "text") }.should raise_error(Net::FTPPermError) end end end diff --git a/spec/ruby/library/net/ftp/site_spec.rb b/spec/ruby/library/net/ftp/site_spec.rb index 85aa2609c1..4d6a9b4a0c 100644 --- a/spec/ruby/library/net/ftp/site_spec.rb +++ b/spec/ruby/library/net/ftp/site_spec.rb @@ -28,26 +28,26 @@ describe "Net::FTP#site" do it "does not raise an error when the response code is 202" do @server.should_receive(:site).and_respond("202 Command not implemented, superfluous at this site.") - lambda { @ftp.site("param") }.should_not raise_error + -> { @ftp.site("param") }.should_not raise_error end it "raises a Net::FTPPermError when the response code is 500" do @server.should_receive(:site).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.site("param") }.should raise_error(Net::FTPPermError) + -> { @ftp.site("param") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:site).and_respond("501 Syntax error in parameters or arguments.") - lambda { @ftp.site("param") }.should raise_error(Net::FTPPermError) + -> { @ftp.site("param") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:site).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.site("param") }.should raise_error(Net::FTPTempError) + -> { @ftp.site("param") }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 530" do @server.should_receive(:site).and_respond("530 Requested action not taken.") - lambda { @ftp.site("param") }.should raise_error(Net::FTPPermError) + -> { @ftp.site("param") }.should raise_error(Net::FTPPermError) end end diff --git a/spec/ruby/library/net/ftp/size_spec.rb b/spec/ruby/library/net/ftp/size_spec.rb index eb3ee90d0f..17615079e9 100644 --- a/spec/ruby/library/net/ftp/size_spec.rb +++ b/spec/ruby/library/net/ftp/size_spec.rb @@ -28,21 +28,21 @@ describe "Net::FTP#size" do it "raises a Net::FTPPermError when the response code is 500" do @server.should_receive(:size).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.size("test.file") }.should raise_error(Net::FTPPermError) + -> { @ftp.size("test.file") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:size).and_respond("501 Syntax error in parameters or arguments.") - lambda { @ftp.size("test.file") }.should raise_error(Net::FTPPermError) + -> { @ftp.size("test.file") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:size).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.size("test.file") }.should raise_error(Net::FTPTempError) + -> { @ftp.size("test.file") }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 550" do @server.should_receive(:size).and_respond("550 Requested action not taken.") - lambda { @ftp.size("test.file") }.should raise_error(Net::FTPPermError) + -> { @ftp.size("test.file") }.should raise_error(Net::FTPPermError) end end diff --git a/spec/ruby/library/net/ftp/status_spec.rb b/spec/ruby/library/net/ftp/status_spec.rb index c3874ea41e..6e3840bf93 100644 --- a/spec/ruby/library/net/ftp/status_spec.rb +++ b/spec/ruby/library/net/ftp/status_spec.rb @@ -32,36 +32,36 @@ describe "Net::FTP#status" do it "does not raise an error when the response code is 212" do @server.should_receive(:stat).and_respond("212 Directory status.") - lambda { @ftp.status }.should_not raise_error + -> { @ftp.status }.should_not raise_error end it "does not raise an error when the response code is 213" do @server.should_receive(:stat).and_respond("213 File status.") - lambda { @ftp.status }.should_not raise_error + -> { @ftp.status }.should_not raise_error end it "raises a Net::FTPPermError when the response code is 500" do @server.should_receive(:stat).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.status }.should raise_error(Net::FTPPermError) + -> { @ftp.status }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:stat).and_respond("501 Syntax error in parameters or arguments.") - lambda { @ftp.status }.should raise_error(Net::FTPPermError) + -> { @ftp.status }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 502" do @server.should_receive(:stat).and_respond("502 Command not implemented.") - lambda { @ftp.status }.should raise_error(Net::FTPPermError) + -> { @ftp.status }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:stat).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.status }.should raise_error(Net::FTPTempError) + -> { @ftp.status }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 530" do @server.should_receive(:stat).and_respond("530 Requested action not taken.") - lambda { @ftp.status }.should raise_error(Net::FTPPermError) + -> { @ftp.status }.should raise_error(Net::FTPPermError) end end diff --git a/spec/ruby/library/net/ftp/system_spec.rb b/spec/ruby/library/net/ftp/system_spec.rb index 73a5ddc72f..749258622d 100644 --- a/spec/ruby/library/net/ftp/system_spec.rb +++ b/spec/ruby/library/net/ftp/system_spec.rb @@ -28,21 +28,21 @@ describe "Net::FTP#system" do it "raises a Net::FTPPermError when the response code is 500" do @server.should_receive(:syst).and_respond("500 Syntax error, command unrecognized.") - lambda { @ftp.system }.should raise_error(Net::FTPPermError) + -> { @ftp.system }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 501" do @server.should_receive(:syst).and_respond("501 Syntax error in parameters or arguments.") - lambda { @ftp.system }.should raise_error(Net::FTPPermError) + -> { @ftp.system }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPPermError when the response code is 502" do @server.should_receive(:syst).and_respond("502 Command not implemented.") - lambda { @ftp.system }.should raise_error(Net::FTPPermError) + -> { @ftp.system }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPTempError when the response code is 421" do @server.should_receive(:syst).and_respond("421 Service not available, closing control connection.") - lambda { @ftp.system }.should raise_error(Net::FTPTempError) + -> { @ftp.system }.should raise_error(Net::FTPTempError) end end diff --git a/spec/ruby/library/net/ftp/voidcmd_spec.rb b/spec/ruby/library/net/ftp/voidcmd_spec.rb index 5e82b70a78..3673c7fd5b 100644 --- a/spec/ruby/library/net/ftp/voidcmd_spec.rb +++ b/spec/ruby/library/net/ftp/voidcmd_spec.rb @@ -19,7 +19,7 @@ describe "Net::FTP#voidcmd" do it "sends the passed command to the server" do @server.should_receive(:help).and_respond("2xx Does not raise.") - lambda { @ftp.voidcmd("HELP") }.should_not raise_error + -> { @ftp.voidcmd("HELP") }.should_not raise_error end it "returns nil" do @@ -29,26 +29,26 @@ describe "Net::FTP#voidcmd" do it "raises a Net::FTPReplyError when the response code is 1xx" do @server.should_receive(:help).and_respond("1xx Does raise a Net::FTPReplyError.") - lambda { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPReplyError) + -> { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPReplyError) end it "raises a Net::FTPReplyError when the response code is 3xx" do @server.should_receive(:help).and_respond("3xx Does raise a Net::FTPReplyError.") - lambda { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPReplyError) + -> { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPReplyError) end it "raises a Net::FTPTempError when the response code is 4xx" do @server.should_receive(:help).and_respond("4xx Does raise a Net::FTPTempError.") - lambda { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPTempError) + -> { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPTempError) end it "raises a Net::FTPPermError when the response code is 5xx" do @server.should_receive(:help).and_respond("5xx Does raise a Net::FTPPermError.") - lambda { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPPermError) + -> { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPPermError) end it "raises a Net::FTPProtoError when the response code is not valid" do @server.should_receive(:help).and_respond("999 Does raise a Net::FTPProtoError.") - lambda { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPProtoError) + -> { @ftp.voidcmd("HELP") }.should raise_error(Net::FTPProtoError) end end diff --git a/spec/ruby/library/net/http/HTTPServerException_spec.rb b/spec/ruby/library/net/http/HTTPServerException_spec.rb index 3960effadd..87841ab499 100644 --- a/spec/ruby/library/net/http/HTTPServerException_spec.rb +++ b/spec/ruby/library/net/http/HTTPServerException_spec.rb @@ -16,11 +16,11 @@ end ruby_version_is "2.6" do describe "Net::HTTPServerException" do it "is a subclass of Net::ProtoServerError and is warned as deprecated" do - lambda { Net::HTTPServerException.should < Net::ProtoServerError }.should complain(/warning: constant Net::HTTPServerException is deprecated/) + -> { Net::HTTPServerException.should < Net::ProtoServerError }.should complain(/warning: constant Net::HTTPServerException is deprecated/) end it "includes the Net::HTTPExceptions module and is warned as deprecated" do - lambda { Net::HTTPServerException.should < Net::HTTPExceptions }.should complain(/warning: constant Net::HTTPServerException is deprecated/) + -> { Net::HTTPServerException.should < Net::HTTPExceptions }.should complain(/warning: constant Net::HTTPServerException is deprecated/) end end end diff --git a/spec/ruby/library/net/http/http/finish_spec.rb b/spec/ruby/library/net/http/http/finish_spec.rb index b031c58e2c..f98bc7be13 100644 --- a/spec/ruby/library/net/http/http/finish_spec.rb +++ b/spec/ruby/library/net/http/http/finish_spec.rb @@ -23,7 +23,7 @@ describe "Net::HTTP#finish" do describe "when self has not been started yet" do it "raises an IOError" do - lambda { @http.finish }.should raise_error(IOError) + -> { @http.finish }.should raise_error(IOError) end end end diff --git a/spec/ruby/library/net/http/http/get_print_spec.rb b/spec/ruby/library/net/http/http/get_print_spec.rb index 6174e3eb21..f59dd68c81 100644 --- a/spec/ruby/library/net/http/http/get_print_spec.rb +++ b/spec/ruby/library/net/http/http/get_print_spec.rb @@ -14,7 +14,7 @@ describe "Net::HTTP.get_print" do describe "when passed URI" do it "it prints the body of the specified uri to $stdout" do - lambda do + -> do Net::HTTP.get_print URI.parse("http://localhost:#{@port}/") end.should output(/This is the index page\./) end @@ -22,7 +22,7 @@ describe "Net::HTTP.get_print" do describe "when passed host, path, port" do it "it prints the body of the specified uri to $stdout" do - lambda do + -> do Net::HTTP.get_print 'localhost', "/", @port end.should output(/This is the index page\./) end diff --git a/spec/ruby/library/net/http/http/set_debug_output_spec.rb b/spec/ruby/library/net/http/http/set_debug_output_spec.rb index e0fe4796da..94b6f4499d 100644 --- a/spec/ruby/library/net/http/http/set_debug_output_spec.rb +++ b/spec/ruby/library/net/http/http/set_debug_output_spec.rb @@ -28,6 +28,6 @@ describe "Net::HTTP#set_debug_output when passed io" do it "outputs a warning when the connection has already been started" do @http.start - lambda { @http.set_debug_output(StringIO.new) }.should complain(/Net::HTTP#set_debug_output called after HTTP started/) + -> { @http.set_debug_output(StringIO.new) }.should complain(/Net::HTTP#set_debug_output called after HTTP started/) end end diff --git a/spec/ruby/library/net/http/http/start_spec.rb b/spec/ruby/library/net/http/http/start_spec.rb index e23f9183f7..a2768eed18 100644 --- a/spec/ruby/library/net/http/http/start_spec.rb +++ b/spec/ruby/library/net/http/http/start_spec.rb @@ -81,7 +81,7 @@ describe "Net::HTTP#start" do describe "when self has already been started" do it "raises an IOError" do @http.start - lambda { @http.start }.should raise_error(IOError) + -> { @http.start }.should raise_error(IOError) end end diff --git a/spec/ruby/library/net/http/httpgenericrequest/body_exist_spec.rb b/spec/ruby/library/net/http/httpgenericrequest/body_exist_spec.rb index 9b04bffb2e..7d081939b8 100644 --- a/spec/ruby/library/net/http/httpgenericrequest/body_exist_spec.rb +++ b/spec/ruby/library/net/http/httpgenericrequest/body_exist_spec.rb @@ -13,7 +13,7 @@ describe "Net::HTTPGenericRequest#body_exist?" do describe "when $VERBOSE is true" do it "emits a warning" do request = Net::HTTPGenericRequest.new("POST", true, false, "/some/path") - lambda { + -> { request.body_exist? }.should complain(/body_exist\? is obsolete/, verbose: true) end diff --git a/spec/ruby/library/net/http/httpgenericrequest/exec_spec.rb b/spec/ruby/library/net/http/httpgenericrequest/exec_spec.rb index 90e158a159..da5b1a63be 100644 --- a/spec/ruby/library/net/http/httpgenericrequest/exec_spec.rb +++ b/spec/ruby/library/net/http/httpgenericrequest/exec_spec.rb @@ -125,7 +125,7 @@ describe "Net::HTTPGenericRequest#exec when passed socket, version, path" do "Content-Type" => "text/html") request.body_stream = StringIO.new("Some Content") - lambda { request.exec(@buffered_socket, "1.1", "/some/other/path") }.should raise_error(ArgumentError) + -> { request.exec(@buffered_socket, "1.1", "/some/other/path") }.should raise_error(ArgumentError) end end end diff --git a/spec/ruby/library/net/http/httpgenericrequest/set_body_internal_spec.rb b/spec/ruby/library/net/http/httpgenericrequest/set_body_internal_spec.rb index ef2edc019a..7494c69173 100644 --- a/spec/ruby/library/net/http/httpgenericrequest/set_body_internal_spec.rb +++ b/spec/ruby/library/net/http/httpgenericrequest/set_body_internal_spec.rb @@ -13,9 +13,9 @@ describe "Net::HTTPGenericRequest#set_body_internal when passed string" do it "raises an ArgumentError when the body or body_stream of self have already been set" do @request.body = "Some Content" - lambda { @request.set_body_internal("Some other Content") }.should raise_error(ArgumentError) + -> { @request.set_body_internal("Some other Content") }.should raise_error(ArgumentError) @request.body_stream = "Some Content" - lambda { @request.set_body_internal("Some other Content") }.should raise_error(ArgumentError) + -> { @request.set_body_internal("Some other Content") }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/net/http/httpheader/content_length_spec.rb b/spec/ruby/library/net/http/httpheader/content_length_spec.rb index 44c971c98e..e344817e82 100644 --- a/spec/ruby/library/net/http/httpheader/content_length_spec.rb +++ b/spec/ruby/library/net/http/httpheader/content_length_spec.rb @@ -13,7 +13,7 @@ describe "Net::HTTPHeader#content_length" do it "raises a Net::HTTPHeaderSyntaxError when the 'Content-Length' header entry has an invalid format" do @headers["Content-Length"] = "invalid" - lambda { @headers.content_length }.should raise_error(Net::HTTPHeaderSyntaxError) + -> { @headers.content_length }.should raise_error(Net::HTTPHeaderSyntaxError) end it "returns the value of the 'Content-Length' header entry as an Integer" do diff --git a/spec/ruby/library/net/http/httpheader/content_range_spec.rb b/spec/ruby/library/net/http/httpheader/content_range_spec.rb index 23dc92348b..ba75f9a9a1 100644 --- a/spec/ruby/library/net/http/httpheader/content_range_spec.rb +++ b/spec/ruby/library/net/http/httpheader/content_range_spec.rb @@ -21,12 +21,12 @@ describe "Net::HTTPHeader#content_range" do it "raises a Net::HTTPHeaderSyntaxError when the 'Content-Range' has an invalid format" do @headers["Content-Range"] = "invalid" - lambda { @headers.content_range }.should raise_error(Net::HTTPHeaderSyntaxError) + -> { @headers.content_range }.should raise_error(Net::HTTPHeaderSyntaxError) @headers["Content-Range"] = "bytes 123-abc" - lambda { @headers.content_range }.should raise_error(Net::HTTPHeaderSyntaxError) + -> { @headers.content_range }.should raise_error(Net::HTTPHeaderSyntaxError) @headers["Content-Range"] = "bytes abc-123" - lambda { @headers.content_range }.should raise_error(Net::HTTPHeaderSyntaxError) + -> { @headers.content_range }.should raise_error(Net::HTTPHeaderSyntaxError) end end diff --git a/spec/ruby/library/net/http/httpheader/fetch_spec.rb b/spec/ruby/library/net/http/httpheader/fetch_spec.rb index 4d608cdb0d..ea15679acb 100644 --- a/spec/ruby/library/net/http/httpheader/fetch_spec.rb +++ b/spec/ruby/library/net/http/httpheader/fetch_spec.rb @@ -25,7 +25,7 @@ describe "Net::HTTPHeader#fetch" do end it "returns nil when there is no entry for the passed key" do - lambda { @headers.fetch("my-header") }.should raise_error(IndexError) + -> { @headers.fetch("my-header") }.should raise_error(IndexError) end end diff --git a/spec/ruby/library/net/http/httpheader/initialize_http_header_spec.rb b/spec/ruby/library/net/http/httpheader/initialize_http_header_spec.rb index 35768b4e7e..efc5e7d0b2 100644 --- a/spec/ruby/library/net/http/httpheader/initialize_http_header_spec.rb +++ b/spec/ruby/library/net/http/httpheader/initialize_http_header_spec.rb @@ -14,7 +14,7 @@ describe "Net::HTTPHeader#initialize_http_header when passed Hash" do end it "complains about duplicate keys when in verbose mode" do - lambda do + -> do @headers.initialize_http_header("My-Header" => "test", "my-header" => "another test") end.should complain(/duplicated HTTP header/, verbose: true) end diff --git a/spec/ruby/library/net/http/httpheader/range_length_spec.rb b/spec/ruby/library/net/http/httpheader/range_length_spec.rb index 4415c8e5ba..b8fce4f690 100644 --- a/spec/ruby/library/net/http/httpheader/range_length_spec.rb +++ b/spec/ruby/library/net/http/httpheader/range_length_spec.rb @@ -21,12 +21,12 @@ describe "Net::HTTPHeader#range_length" do it "raises a Net::HTTPHeaderSyntaxError when the 'Content-Range' has an invalid format" do @headers["Content-Range"] = "invalid" - lambda { @headers.range_length }.should raise_error(Net::HTTPHeaderSyntaxError) + -> { @headers.range_length }.should raise_error(Net::HTTPHeaderSyntaxError) @headers["Content-Range"] = "bytes 123-abc" - lambda { @headers.range_length }.should raise_error(Net::HTTPHeaderSyntaxError) + -> { @headers.range_length }.should raise_error(Net::HTTPHeaderSyntaxError) @headers["Content-Range"] = "bytes abc-123" - lambda { @headers.range_length }.should raise_error(Net::HTTPHeaderSyntaxError) + -> { @headers.range_length }.should raise_error(Net::HTTPHeaderSyntaxError) end end diff --git a/spec/ruby/library/net/http/httpheader/range_spec.rb b/spec/ruby/library/net/http/httpheader/range_spec.rb index 5f06e03a1c..005177f6be 100644 --- a/spec/ruby/library/net/http/httpheader/range_spec.rb +++ b/spec/ruby/library/net/http/httpheader/range_spec.rb @@ -28,18 +28,18 @@ describe "Net::HTTPHeader#range" do it "raises a Net::HTTPHeaderSyntaxError when the 'Range' has an invalid format" do @headers["Range"] = "invalid" - lambda { @headers.range }.should raise_error(Net::HTTPHeaderSyntaxError) + -> { @headers.range }.should raise_error(Net::HTTPHeaderSyntaxError) @headers["Range"] = "bytes 123-abc" - lambda { @headers.range }.should raise_error(Net::HTTPHeaderSyntaxError) + -> { @headers.range }.should raise_error(Net::HTTPHeaderSyntaxError) @headers["Range"] = "bytes abc-123" - lambda { @headers.range }.should raise_error(Net::HTTPHeaderSyntaxError) + -> { @headers.range }.should raise_error(Net::HTTPHeaderSyntaxError) end it "raises a Net::HTTPHeaderSyntaxError when the 'Range' was not specified" do @headers["Range"] = "bytes=-" - lambda { @headers.range }.should raise_error(Net::HTTPHeaderSyntaxError) + -> { @headers.range }.should raise_error(Net::HTTPHeaderSyntaxError) end end diff --git a/spec/ruby/library/net/http/httpheader/shared/set_range.rb b/spec/ruby/library/net/http/httpheader/shared/set_range.rb index 6a98edbe10..87f51d46f3 100644 --- a/spec/ruby/library/net/http/httpheader/shared/set_range.rb +++ b/spec/ruby/library/net/http/httpheader/shared/set_range.rb @@ -50,15 +50,15 @@ describe :net_httpheader_set_range, shared: true do end it "raises a Net::HTTPHeaderSyntaxError when the first Range element is negative" do - lambda { @headers.send(@method, -10..5) }.should raise_error(Net::HTTPHeaderSyntaxError) + -> { @headers.send(@method, -10..5) }.should raise_error(Net::HTTPHeaderSyntaxError) end it "raises a Net::HTTPHeaderSyntaxError when the last Range element is negative" do - lambda { @headers.send(@method, 10..-5) }.should raise_error(Net::HTTPHeaderSyntaxError) + -> { @headers.send(@method, 10..-5) }.should raise_error(Net::HTTPHeaderSyntaxError) end it "raises a Net::HTTPHeaderSyntaxError when the last Range element is smaller than the first" do - lambda { @headers.send(@method, 10..5) }.should raise_error(Net::HTTPHeaderSyntaxError) + -> { @headers.send(@method, 10..5) }.should raise_error(Net::HTTPHeaderSyntaxError) end end @@ -75,15 +75,15 @@ describe :net_httpheader_set_range, shared: true do end it "raises a Net::HTTPHeaderSyntaxError when start is negative" do - lambda { @headers.send(@method, -10, 5) }.should raise_error(Net::HTTPHeaderSyntaxError) + -> { @headers.send(@method, -10, 5) }.should raise_error(Net::HTTPHeaderSyntaxError) end it "raises a Net::HTTPHeaderSyntaxError when start + length is negative" do - lambda { @headers.send(@method, 10, -15) }.should raise_error(Net::HTTPHeaderSyntaxError) + -> { @headers.send(@method, 10, -15) }.should raise_error(Net::HTTPHeaderSyntaxError) end it "raises a Net::HTTPHeaderSyntaxError when length is negative" do - lambda { @headers.send(@method, 10, -4) }.should raise_error(Net::HTTPHeaderSyntaxError) + -> { @headers.send(@method, 10, -4) }.should raise_error(Net::HTTPHeaderSyntaxError) end end end diff --git a/spec/ruby/library/net/http/httpresponse/error_spec.rb b/spec/ruby/library/net/http/httpresponse/error_spec.rb index a3a3cee162..d2b2f53d89 100644 --- a/spec/ruby/library/net/http/httpresponse/error_spec.rb +++ b/spec/ruby/library/net/http/httpresponse/error_spec.rb @@ -4,26 +4,26 @@ require 'net/http' describe "Net::HTTPResponse#error!" do it "raises self's class 'EXCEPTION_TYPE' Exception" do res = Net::HTTPUnknownResponse.new("1.0", "???", "test response") - lambda { res.error! }.should raise_error(Net::HTTPError) + -> { res.error! }.should raise_error(Net::HTTPError) res = Net::HTTPInformation.new("1.0", "1xx", "test response") - lambda { res.error! }.should raise_error(Net::HTTPError) + -> { res.error! }.should raise_error(Net::HTTPError) res = Net::HTTPSuccess.new("1.0", "2xx", "test response") - lambda { res.error! }.should raise_error(Net::HTTPError) + -> { res.error! }.should raise_error(Net::HTTPError) res = Net::HTTPRedirection.new("1.0", "3xx", "test response") - lambda { res.error! }.should raise_error(Net::HTTPRetriableError) + -> { res.error! }.should raise_error(Net::HTTPRetriableError) res = Net::HTTPClientError.new("1.0", "4xx", "test response") ruby_version_is ""..."2.6" do - lambda { res.error! }.should raise_error(Net::HTTPServerException) + -> { res.error! }.should raise_error(Net::HTTPServerException) end ruby_version_is "2.6" do - lambda { res.error! }.should raise_error(Net::HTTPClientException) + -> { res.error! }.should raise_error(Net::HTTPClientException) end res = Net::HTTPServerError.new("1.0", "5xx", "test response") - lambda { res.error! }.should raise_error(Net::HTTPFatalError) + -> { res.error! }.should raise_error(Net::HTTPFatalError) end end diff --git a/spec/ruby/library/net/http/httpresponse/read_body_spec.rb b/spec/ruby/library/net/http/httpresponse/read_body_spec.rb index a050eca594..99d8e5fa88 100644 --- a/spec/ruby/library/net/http/httpresponse/read_body_spec.rb +++ b/spec/ruby/library/net/http/httpresponse/read_body_spec.rb @@ -40,7 +40,7 @@ describe "Net::HTTPResponse#read_body" do it "raises an IOError if called a second time" do @res.reading_body(@socket, true) do @res.read_body("") - lambda { @res.read_body("") }.should raise_error(IOError) + -> { @res.read_body("") }.should raise_error(IOError) end end end @@ -70,7 +70,7 @@ describe "Net::HTTPResponse#read_body" do it "raises an IOError if called a second time" do @res.reading_body(@socket, true) do @res.read_body {} - lambda { @res.read_body {} }.should raise_error(IOError) + -> { @res.read_body {} }.should raise_error(IOError) end end end @@ -78,7 +78,7 @@ describe "Net::HTTPResponse#read_body" do describe "when passed buffer and block" do it "raises an ArgumentError" do @res.reading_body(@socket, true) do - lambda { @res.read_body("") {} }.should raise_error(ArgumentError) + -> { @res.read_body("") {} }.should raise_error(ArgumentError) end end end diff --git a/spec/ruby/library/net/http/httpresponse/value_spec.rb b/spec/ruby/library/net/http/httpresponse/value_spec.rb index 1b19d1d6f7..4a5930d4e5 100644 --- a/spec/ruby/library/net/http/httpresponse/value_spec.rb +++ b/spec/ruby/library/net/http/httpresponse/value_spec.rb @@ -4,26 +4,26 @@ require 'net/http' describe "Net::HTTPResponse#value" do it "raises an HTTP error for non 2xx HTTP Responses" do res = Net::HTTPUnknownResponse.new("1.0", "???", "test response") - lambda { res.value }.should raise_error(Net::HTTPError) + -> { res.value }.should raise_error(Net::HTTPError) res = Net::HTTPInformation.new("1.0", "1xx", "test response") - lambda { res.value }.should raise_error(Net::HTTPError) + -> { res.value }.should raise_error(Net::HTTPError) res = Net::HTTPSuccess.new("1.0", "2xx", "test response") - lambda { res.value }.should_not raise_error(Net::HTTPError) + -> { res.value }.should_not raise_error(Net::HTTPError) res = Net::HTTPRedirection.new("1.0", "3xx", "test response") - lambda { res.value }.should raise_error(Net::HTTPRetriableError) + -> { res.value }.should raise_error(Net::HTTPRetriableError) res = Net::HTTPClientError.new("1.0", "4xx", "test response") ruby_version_is ""..."2.6" do - lambda { res.value }.should raise_error(Net::HTTPServerException) + -> { res.value }.should raise_error(Net::HTTPServerException) end ruby_version_is "2.6" do - lambda { res.value }.should raise_error(Net::HTTPClientException) + -> { res.value }.should raise_error(Net::HTTPClientException) end res = Net::HTTPServerError.new("1.0", "5xx", "test response") - lambda { res.value }.should raise_error(Net::HTTPFatalError) + -> { res.value }.should raise_error(Net::HTTPFatalError) end end diff --git a/spec/ruby/library/observer/notify_observers_spec.rb b/spec/ruby/library/observer/notify_observers_spec.rb index 86422fc4a0..31f82e9266 100644 --- a/spec/ruby/library/observer/notify_observers_spec.rb +++ b/spec/ruby/library/observer/notify_observers_spec.rb @@ -16,7 +16,7 @@ describe "Observer#notify_observers" do end it "verifies observer responds to update" do - lambda { + -> { @observable.add_observer(@observable) }.should raise_error(NoMethodError) end diff --git a/spec/ruby/library/openssl/config/freeze_spec.rb b/spec/ruby/library/openssl/config/freeze_spec.rb index 69c96cf85e..1876095d9f 100644 --- a/spec/ruby/library/openssl/config/freeze_spec.rb +++ b/spec/ruby/library/openssl/config/freeze_spec.rb @@ -8,12 +8,12 @@ describe "OpenSSL::Config#freeze" do it "freezes" do c = OpenSSL::Config.new - lambda { + -> { c['foo'] = [ ['key', 'value'] ] }.should_not raise_error c.freeze c.frozen?.should be_true - lambda { + -> { c['foo'] = [ ['key', 'value'] ] }.should raise_error(TypeError) end diff --git a/spec/ruby/library/openssl/random/shared/random_bytes.rb b/spec/ruby/library/openssl/random/shared/random_bytes.rb index 3a3a6b2bc4..037f10d409 100644 --- a/spec/ruby/library/openssl/random/shared/random_bytes.rb +++ b/spec/ruby/library/openssl/random/shared/random_bytes.rb @@ -22,7 +22,7 @@ describe :openssl_random_bytes, shared: true do |cmd| end it "raises ArgumentError on negative arguments" do - lambda { + -> { OpenSSL::Random.send(@method, -1) }.should raise_error(ArgumentError) end diff --git a/spec/ruby/library/openssl/x509/name/parse_spec.rb b/spec/ruby/library/openssl/x509/name/parse_spec.rb index 6a43f5aea3..6624161d83 100644 --- a/spec/ruby/library/openssl/x509/name/parse_spec.rb +++ b/spec/ruby/library/openssl/x509/name/parse_spec.rb @@ -35,13 +35,13 @@ describe "OpenSSL::X509::Name.parse" do end it "raises TypeError if the given string contains no key/value pairs" do - lambda do + -> do OpenSSL::X509::Name.parse("hello") end.should raise_error(TypeError) end it "raises OpenSSL::X509::NameError if the given string contains invalid keys" do - lambda do + -> do OpenSSL::X509::Name.parse("hello=goodbye") end.should raise_error(OpenSSL::X509::NameError) end diff --git a/spec/ruby/library/openstruct/frozen_spec.rb b/spec/ruby/library/openstruct/frozen_spec.rb index 142adcb278..63767bb54d 100644 --- a/spec/ruby/library/openstruct/frozen_spec.rb +++ b/spec/ruby/library/openstruct/frozen_spec.rb @@ -15,18 +15,18 @@ describe "OpenStruct.new when frozen" do end it "is not writable" do - lambda{ @os.age = 42 }.should raise_error( RuntimeError ) + ->{ @os.age = 42 }.should raise_error( RuntimeError ) end it "cannot create new fields" do - lambda{ @os.state = :new }.should raise_error( RuntimeError ) + ->{ @os.state = :new }.should raise_error( RuntimeError ) end it "creates a frozen clone" do f = @os.clone f.age.should == 70 - lambda{ f.age = 0 }.should raise_error( RuntimeError ) - lambda{ f.state = :newer }.should raise_error( RuntimeError ) + ->{ f.age = 0 }.should raise_error( RuntimeError ) + ->{ f.state = :newer }.should raise_error( RuntimeError ) end it "creates an unfrozen dup" do diff --git a/spec/ruby/library/openstruct/method_missing_spec.rb b/spec/ruby/library/openstruct/method_missing_spec.rb index 5f85b2e513..1992b7255c 100644 --- a/spec/ruby/library/openstruct/method_missing_spec.rb +++ b/spec/ruby/library/openstruct/method_missing_spec.rb @@ -7,12 +7,12 @@ describe "OpenStruct#method_missing when called with a method name ending in '=' end it "raises an ArgumentError when not passed any additional arguments" do - lambda { @os.method_missing(:test=) }.should raise_error(ArgumentError) + -> { @os.method_missing(:test=) }.should raise_error(ArgumentError) end it "raises a TypeError when self is frozen" do @os.freeze - lambda { @os.method_missing(:test=, "test") }.should raise_error(RuntimeError) + -> { @os.method_missing(:test=, "test") }.should raise_error(RuntimeError) end it "creates accessor methods" do @@ -29,13 +29,13 @@ end describe "OpenStruct#method_missing when passed additional arguments" do it "raises a NoMethodError when the key does not exist" do os = OpenStruct.new - lambda { os.method_missing(:test, 1, 2, 3) }.should raise_error(NoMethodError) + -> { os.method_missing(:test, 1, 2, 3) }.should raise_error(NoMethodError) end ruby_version_is "2.7" do it "raises an ArgumentError when the key exists" do os = OpenStruct.new(test: 20) - lambda { os.method_missing(:test, 1, 2, 3) }.should raise_error(ArgumentError) + -> { os.method_missing(:test, 1, 2, 3) }.should raise_error(ArgumentError) end end end diff --git a/spec/ruby/library/pathname/new_spec.rb b/spec/ruby/library/pathname/new_spec.rb index 4f519af398..f400444887 100644 --- a/spec/ruby/library/pathname/new_spec.rb +++ b/spec/ruby/library/pathname/new_spec.rb @@ -7,7 +7,7 @@ describe "Pathname.new" do end it "raises an ArgumentError when called with \0" do - lambda { Pathname.new("\0")}.should raise_error(ArgumentError) + -> { Pathname.new("\0")}.should raise_error(ArgumentError) end it "is tainted if path is tainted" do @@ -16,10 +16,10 @@ describe "Pathname.new" do end it "raises a TypeError if not passed a String type" do - lambda { Pathname.new(nil) }.should raise_error(TypeError) - lambda { Pathname.new(0) }.should raise_error(TypeError) - lambda { Pathname.new(true) }.should raise_error(TypeError) - lambda { Pathname.new(false) }.should raise_error(TypeError) + -> { Pathname.new(nil) }.should raise_error(TypeError) + -> { Pathname.new(0) }.should raise_error(TypeError) + -> { Pathname.new(true) }.should raise_error(TypeError) + -> { Pathname.new(false) }.should raise_error(TypeError) end it "initializes with an object with to_path" do diff --git a/spec/ruby/library/pathname/relative_path_from_spec.rb b/spec/ruby/library/pathname/relative_path_from_spec.rb index 1a941be926..abe9c80a45 100644 --- a/spec/ruby/library/pathname/relative_path_from_spec.rb +++ b/spec/ruby/library/pathname/relative_path_from_spec.rb @@ -7,11 +7,11 @@ describe "Pathname#relative_path_from" do end it "raises an error when the two paths do not share a common prefix" do - lambda { relative_path_str('/usr', 'foo') }.should raise_error(ArgumentError) + -> { relative_path_str('/usr', 'foo') }.should raise_error(ArgumentError) end it "raises an error when the base directory has .." do - lambda { relative_path_str('a', '..') }.should raise_error(ArgumentError) + -> { relative_path_str('a', '..') }.should raise_error(ArgumentError) end it "returns a path relative from root" do diff --git a/spec/ruby/library/pp/pp_spec.rb b/spec/ruby/library/pp/pp_spec.rb index c4559b35ca..06b22601d8 100644 --- a/spec/ruby/library/pp/pp_spec.rb +++ b/spec/ruby/library/pp/pp_spec.rb @@ -5,7 +5,7 @@ describe "PP.pp" do it 'works with default arguments' do array = [1, 2, 3] - lambda { + -> { PP.pp array }.should output "[1, 2, 3]\n" end @@ -14,7 +14,7 @@ describe "PP.pp" do array = [1, 2, 3] other_out = IOStub.new - lambda { + -> { PP.pp array, other_out }.should output "" # no output on stdout diff --git a/spec/ruby/library/prime/instance_spec.rb b/spec/ruby/library/prime/instance_spec.rb index 156337c46a..5183f36901 100644 --- a/spec/ruby/library/prime/instance_spec.rb +++ b/spec/ruby/library/prime/instance_spec.rb @@ -12,10 +12,10 @@ describe "Prime.instance" do end it "does not complain anything" do - lambda { Prime.instance }.should_not complain + -> { Prime.instance }.should_not complain end it "raises a ArgumentError when is called with some arguments" do - lambda { Prime.instance(1) }.should raise_error(ArgumentError) + -> { Prime.instance(1) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/prime/integer/prime_division_spec.rb b/spec/ruby/library/prime/integer/prime_division_spec.rb index 60ba21037f..be03438a6f 100644 --- a/spec/ruby/library/prime/integer/prime_division_spec.rb +++ b/spec/ruby/library/prime/integer/prime_division_spec.rb @@ -14,6 +14,6 @@ describe "Integer#prime_division" do -1.prime_division.should == [[-1, 1]] end it "raises ZeroDivisionError for 0" do - lambda { 0.prime_division }.should raise_error(ZeroDivisionError) + -> { 0.prime_division }.should raise_error(ZeroDivisionError) end end diff --git a/spec/ruby/library/prime/prime_division_spec.rb b/spec/ruby/library/prime/prime_division_spec.rb index 151b046f44..6293478f59 100644 --- a/spec/ruby/library/prime/prime_division_spec.rb +++ b/spec/ruby/library/prime/prime_division_spec.rb @@ -20,6 +20,6 @@ describe "Prime.prime_division" do end it "raises ZeroDivisionError for 0" do - lambda { Prime.prime_division(0) }.should raise_error(ZeroDivisionError) + -> { Prime.prime_division(0) }.should raise_error(ZeroDivisionError) end end diff --git a/spec/ruby/library/readline/completion_proc_spec.rb b/spec/ruby/library/readline/completion_proc_spec.rb index 721acaa1d0..2d7a353ec5 100644 --- a/spec/ruby/library/readline/completion_proc_spec.rb +++ b/spec/ruby/library/readline/completion_proc_spec.rb @@ -16,7 +16,7 @@ with_feature :readline do end it "returns an ArgumentError if not given an Proc or #call" do - lambda { Readline.completion_proc = "test" }.should raise_error(ArgumentError) + -> { Readline.completion_proc = "test" }.should raise_error(ArgumentError) end end end diff --git a/spec/ruby/library/readline/history/append_spec.rb b/spec/ruby/library/readline/history/append_spec.rb index ee26b01255..5383271374 100644 --- a/spec/ruby/library/readline/history/append_spec.rb +++ b/spec/ruby/library/readline/history/append_spec.rb @@ -22,7 +22,7 @@ with_feature :readline do end it "raises a TypeError when the passed Object can't be converted to a String" do - lambda { Readline::HISTORY << mock("Object") }.should raise_error(TypeError) + -> { Readline::HISTORY << mock("Object") }.should raise_error(TypeError) end end end diff --git a/spec/ruby/library/readline/history/delete_at_spec.rb b/spec/ruby/library/readline/history/delete_at_spec.rb index 407006c20c..8dcce259bb 100644 --- a/spec/ruby/library/readline/history/delete_at_spec.rb +++ b/spec/ruby/library/readline/history/delete_at_spec.rb @@ -31,8 +31,8 @@ with_feature :readline do end it "raises an IndexError when the given index is greater than the history size" do - lambda { Readline::HISTORY.delete_at(10) }.should raise_error(IndexError) - lambda { Readline::HISTORY.delete_at(-10) }.should raise_error(IndexError) + -> { Readline::HISTORY.delete_at(10) }.should raise_error(IndexError) + -> { Readline::HISTORY.delete_at(-10) }.should raise_error(IndexError) end it "taints the returned strings" do diff --git a/spec/ruby/library/readline/history/element_reference_spec.rb b/spec/ruby/library/readline/history/element_reference_spec.rb index a85d069111..09cac5e28f 100644 --- a/spec/ruby/library/readline/history/element_reference_spec.rb +++ b/spec/ruby/library/readline/history/element_reference_spec.rb @@ -28,13 +28,13 @@ with_feature :readline do end it "raises an IndexError when there is no item at the passed index" do - lambda { Readline::HISTORY[-10] }.should raise_error(IndexError) - lambda { Readline::HISTORY[-9] }.should raise_error(IndexError) - lambda { Readline::HISTORY[-8] }.should raise_error(IndexError) + -> { Readline::HISTORY[-10] }.should raise_error(IndexError) + -> { Readline::HISTORY[-9] }.should raise_error(IndexError) + -> { Readline::HISTORY[-8] }.should raise_error(IndexError) - lambda { Readline::HISTORY[8] }.should raise_error(IndexError) - lambda { Readline::HISTORY[9] }.should raise_error(IndexError) - lambda { Readline::HISTORY[10] }.should raise_error(IndexError) + -> { Readline::HISTORY[8] }.should raise_error(IndexError) + -> { Readline::HISTORY[9] }.should raise_error(IndexError) + -> { Readline::HISTORY[10] }.should raise_error(IndexError) end end end diff --git a/spec/ruby/library/readline/history/element_set_spec.rb b/spec/ruby/library/readline/history/element_set_spec.rb index 67ecf0ef2b..776adaacd1 100644 --- a/spec/ruby/library/readline/history/element_set_spec.rb +++ b/spec/ruby/library/readline/history/element_set_spec.rb @@ -17,7 +17,7 @@ with_feature :readline do end it "raises an IndexError when there is no item at the passed positive index" do - lambda { Readline::HISTORY[10] = "test" }.should raise_error(IndexError) + -> { Readline::HISTORY[10] = "test" }.should raise_error(IndexError) end it "sets the item at the given index" do @@ -29,7 +29,7 @@ with_feature :readline do end it "raises an IndexError when there is no item at the passed negative index" do - lambda { Readline::HISTORY[10] = "test" }.should raise_error(IndexError) + -> { Readline::HISTORY[10] = "test" }.should raise_error(IndexError) end end end diff --git a/spec/ruby/library/readline/history/push_spec.rb b/spec/ruby/library/readline/history/push_spec.rb index f91121f351..53505ccba6 100644 --- a/spec/ruby/library/readline/history/push_spec.rb +++ b/spec/ruby/library/readline/history/push_spec.rb @@ -20,7 +20,7 @@ with_feature :readline do end it "raises a TypeError when the passed Object can't be converted to a String" do - lambda { Readline::HISTORY.push(mock("Object")) }.should raise_error(TypeError) + -> { Readline::HISTORY.push(mock("Object")) }.should raise_error(TypeError) end end end diff --git a/spec/ruby/library/resolv/get_address_spec.rb b/spec/ruby/library/resolv/get_address_spec.rb index baa2b118f3..ecc2cdf7de 100644 --- a/spec/ruby/library/resolv/get_address_spec.rb +++ b/spec/ruby/library/resolv/get_address_spec.rb @@ -12,7 +12,7 @@ describe "Resolv#getaddress" do it "raises ResolvError if the name can not be looked up" do res = Resolv.new([]) - lambda { + -> { res.getaddress("should.raise.error.") }.should raise_error(Resolv::ResolvError) end diff --git a/spec/ruby/library/resolv/get_name_spec.rb b/spec/ruby/library/resolv/get_name_spec.rb index 70b91e19e8..3ef97a2cea 100644 --- a/spec/ruby/library/resolv/get_name_spec.rb +++ b/spec/ruby/library/resolv/get_name_spec.rb @@ -11,7 +11,7 @@ describe "Resolv#getname" do it "raises ResolvError when there is no result" do res = Resolv.new([]) - lambda { + -> { res.getname("should.raise.error") }.should raise_error(Resolv::ResolvError) end diff --git a/spec/ruby/library/rexml/attribute/remove_spec.rb b/spec/ruby/library/rexml/attribute/remove_spec.rb index b97b860a5f..08d22cb6ba 100644 --- a/spec/ruby/library/rexml/attribute/remove_spec.rb +++ b/spec/ruby/library/rexml/attribute/remove_spec.rb @@ -15,6 +15,6 @@ describe "REXML::Attribute#remove" do end it "does not anything if element has no parent" do - lambda {@attr.remove}.should_not raise_error(Exception) + -> {@attr.remove}.should_not raise_error(Exception) end end diff --git a/spec/ruby/library/rexml/attribute/xpath_spec.rb b/spec/ruby/library/rexml/attribute/xpath_spec.rb index beefb036cc..8335e0a8ef 100644 --- a/spec/ruby/library/rexml/attribute/xpath_spec.rb +++ b/spec/ruby/library/rexml/attribute/xpath_spec.rb @@ -14,6 +14,6 @@ describe "REXML::Attribute#xpath" do end it "raises an error if attribute has no parent" do - lambda { @attr.xpath }.should raise_error(Exception) + -> { @attr.xpath }.should raise_error(Exception) end end diff --git a/spec/ruby/library/rexml/document/add_spec.rb b/spec/ruby/library/rexml/document/add_spec.rb index a200da1e3d..db95114e7e 100644 --- a/spec/ruby/library/rexml/document/add_spec.rb +++ b/spec/ruby/library/rexml/document/add_spec.rb @@ -44,7 +44,7 @@ describe :rexml_document_add, shared: true do end it "refuses to add second root" do - lambda { @doc.send(@method, REXML::Element.new("foo")) }.should raise_error(RuntimeError) + -> { @doc.send(@method, REXML::Element.new("foo")) }.should raise_error(RuntimeError) end end diff --git a/spec/ruby/library/rexml/document/new_spec.rb b/spec/ruby/library/rexml/document/new_spec.rb index 39e806a472..3ff5e99b25 100644 --- a/spec/ruby/library/rexml/document/new_spec.rb +++ b/spec/ruby/library/rexml/document/new_spec.rb @@ -27,7 +27,7 @@ describe "REXML::Document#new" do end it "raises an error if source is not a Document, String or IO" do - lambda {REXML::Document.new(3)}.should raise_error(RuntimeError) + -> {REXML::Document.new(3)}.should raise_error(RuntimeError) end it "does not perform XML validation" do diff --git a/spec/ruby/library/rexml/text/new_spec.rb b/spec/ruby/library/rexml/text/new_spec.rb index a1fdcddf28..3c081dec30 100644 --- a/spec/ruby/library/rexml/text/new_spec.rb +++ b/spec/ruby/library/rexml/text/new_spec.rb @@ -28,12 +28,12 @@ describe "REXML::Text.new" do t = REXML::Text.new("<&>", false, nil, true) t.should == "<&>" - lambda{ REXML::Text.new("<&>", false, nil, true)}.should raise_error(Exception) + ->{ REXML::Text.new("<&>", false, nil, true)}.should raise_error(Exception) end it "uses raw value of the parent if raw is nil" do e1 = REXML::Element.new("root", nil, { raw: :all}) - lambda {REXML::Text.new("<&>", false, e1)}.should raise_error(Exception) + -> {REXML::Text.new("<&>", false, e1)}.should raise_error(Exception) e2 = REXML::Element.new("root", nil, { raw: []}) e2.raw.should be_false diff --git a/spec/ruby/library/rexml/text/read_with_substitution_spec.rb b/spec/ruby/library/rexml/text/read_with_substitution_spec.rb index a9b4d30bc5..83b42f6d6b 100644 --- a/spec/ruby/library/rexml/text/read_with_substitution_spec.rb +++ b/spec/ruby/library/rexml/text/read_with_substitution_spec.rb @@ -7,6 +7,6 @@ describe "REXML::Text.read_with_substitution" do end it "accepts an regex for invalid expressions and raises an error if text matches" do - lambda {REXML::Text.read_with_substitution("this is illegal", /illegal/)}.should raise_error(Exception) + -> {REXML::Text.read_with_substitution("this is illegal", /illegal/)}.should raise_error(Exception) end end diff --git a/spec/ruby/library/securerandom/base64_spec.rb b/spec/ruby/library/securerandom/base64_spec.rb index c0ddbf85ce..34cd419ce2 100644 --- a/spec/ruby/library/securerandom/base64_spec.rb +++ b/spec/ruby/library/securerandom/base64_spec.rb @@ -42,7 +42,7 @@ describe "SecureRandom.base64" do end it "raises ArgumentError on negative arguments" do - lambda { + -> { SecureRandom.base64(-1) }.should raise_error(ArgumentError) end diff --git a/spec/ruby/library/securerandom/hex_spec.rb b/spec/ruby/library/securerandom/hex_spec.rb index 525b4d1e35..bdb920b217 100644 --- a/spec/ruby/library/securerandom/hex_spec.rb +++ b/spec/ruby/library/securerandom/hex_spec.rb @@ -41,7 +41,7 @@ describe "SecureRandom.hex" do end it "raises ArgumentError on negative arguments" do - lambda { + -> { SecureRandom.hex(-1) }.should raise_error(ArgumentError) end diff --git a/spec/ruby/library/securerandom/random_bytes_spec.rb b/spec/ruby/library/securerandom/random_bytes_spec.rb index 7ab949f5d4..275a897315 100644 --- a/spec/ruby/library/securerandom/random_bytes_spec.rb +++ b/spec/ruby/library/securerandom/random_bytes_spec.rb @@ -37,7 +37,7 @@ describe "SecureRandom.random_bytes" do end it "raises ArgumentError on negative arguments" do - lambda { + -> { SecureRandom.random_bytes(-1) }.should raise_error(ArgumentError) end diff --git a/spec/ruby/library/securerandom/random_number_spec.rb b/spec/ruby/library/securerandom/random_number_spec.rb index 6b3279e6d7..3c86f55bf5 100644 --- a/spec/ruby/library/securerandom/random_number_spec.rb +++ b/spec/ruby/library/securerandom/random_number_spec.rb @@ -86,7 +86,7 @@ describe "SecureRandom.random_number" do end it "raises ArgumentError if the argument is non-numeric" do - lambda { + -> { SecureRandom.random_number(Object.new) }.should raise_error(ArgumentError) end diff --git a/spec/ruby/library/set/compare_by_identity_spec.rb b/spec/ruby/library/set/compare_by_identity_spec.rb index 01b66ec92b..a6ad794ad3 100644 --- a/spec/ruby/library/set/compare_by_identity_spec.rb +++ b/spec/ruby/library/set/compare_by_identity_spec.rb @@ -93,7 +93,7 @@ describe "Set#compare_by_identity" do it "raises a #{frozen_error_class} on frozen sets" do set = Set.new.freeze - lambda { + -> { set.compare_by_identity }.should raise_error(frozen_error_class, /frozen Hash/) end diff --git a/spec/ruby/library/set/exclusion_spec.rb b/spec/ruby/library/set/exclusion_spec.rb index c9fa0e287e..5bc4b5a2bf 100644 --- a/spec/ruby/library/set/exclusion_spec.rb +++ b/spec/ruby/library/set/exclusion_spec.rb @@ -12,7 +12,7 @@ describe "Set#^" do end it "raises an ArgumentError when passed a non-Enumerable" do - lambda { @set ^ 3 }.should raise_error(ArgumentError) - lambda { @set ^ Object.new }.should raise_error(ArgumentError) + -> { @set ^ 3 }.should raise_error(ArgumentError) + -> { @set ^ Object.new }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/flatten_merge_spec.rb b/spec/ruby/library/set/flatten_merge_spec.rb index b4494b13a7..f2c99a9481 100644 --- a/spec/ruby/library/set/flatten_merge_spec.rb +++ b/spec/ruby/library/set/flatten_merge_spec.rb @@ -18,6 +18,6 @@ describe "Set#flatten_merge" do set2 = Set[5, 6, 7] set2 << set2 - lambda { set1.send(:flatten_merge, set2) }.should raise_error(ArgumentError) + -> { set1.send(:flatten_merge, set2) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/flatten_spec.rb b/spec/ruby/library/set/flatten_spec.rb index be94630f48..4ac83ea825 100644 --- a/spec/ruby/library/set/flatten_spec.rb +++ b/spec/ruby/library/set/flatten_spec.rb @@ -13,7 +13,7 @@ describe "Set#flatten" do it "raises an ArgumentError when self is recursive" do (set = Set[]) << set - lambda { set.flatten }.should raise_error(ArgumentError) + -> { set.flatten }.should raise_error(ArgumentError) end context "when Set contains a Set-like object" do @@ -42,7 +42,7 @@ describe "Set#flatten!" do it "raises an ArgumentError when self is recursive" do (set = Set[]) << set - lambda { set.flatten! }.should raise_error(ArgumentError) + -> { set.flatten! }.should raise_error(ArgumentError) end context "when Set contains a Set-like object" do diff --git a/spec/ruby/library/set/merge_spec.rb b/spec/ruby/library/set/merge_spec.rb index 5c65af0a9b..a8e3ffc870 100644 --- a/spec/ruby/library/set/merge_spec.rb +++ b/spec/ruby/library/set/merge_spec.rb @@ -13,7 +13,7 @@ describe "Set#merge" do end it "raises an ArgumentError when passed a non-Enumerable" do - lambda { Set[1, 2].merge(1) }.should raise_error(ArgumentError) - lambda { Set[1, 2].merge(Object.new) }.should raise_error(ArgumentError) + -> { Set[1, 2].merge(1) }.should raise_error(ArgumentError) + -> { Set[1, 2].merge(Object.new) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/proper_subset_spec.rb b/spec/ruby/library/set/proper_subset_spec.rb index 20c354b655..1f496a6199 100644 --- a/spec/ruby/library/set/proper_subset_spec.rb +++ b/spec/ruby/library/set/proper_subset_spec.rb @@ -27,10 +27,10 @@ describe "Set#proper_subset?" do end it "raises an ArgumentError when passed a non-Set" do - lambda { Set[].proper_subset?([]) }.should raise_error(ArgumentError) - lambda { Set[].proper_subset?(1) }.should raise_error(ArgumentError) - lambda { Set[].proper_subset?("test") }.should raise_error(ArgumentError) - lambda { Set[].proper_subset?(Object.new) }.should raise_error(ArgumentError) + -> { Set[].proper_subset?([]) }.should raise_error(ArgumentError) + -> { Set[].proper_subset?(1) }.should raise_error(ArgumentError) + -> { Set[].proper_subset?("test") }.should raise_error(ArgumentError) + -> { Set[].proper_subset?(Object.new) }.should raise_error(ArgumentError) end context "when comparing to a Set-like object" do diff --git a/spec/ruby/library/set/proper_superset_spec.rb b/spec/ruby/library/set/proper_superset_spec.rb index abc0e44f96..a386c8c097 100644 --- a/spec/ruby/library/set/proper_superset_spec.rb +++ b/spec/ruby/library/set/proper_superset_spec.rb @@ -27,10 +27,10 @@ describe "Set#proper_superset?" do end it "raises an ArgumentError when passed a non-Set" do - lambda { Set[].proper_superset?([]) }.should raise_error(ArgumentError) - lambda { Set[].proper_superset?(1) }.should raise_error(ArgumentError) - lambda { Set[].proper_superset?("test") }.should raise_error(ArgumentError) - lambda { Set[].proper_superset?(Object.new) }.should raise_error(ArgumentError) + -> { Set[].proper_superset?([]) }.should raise_error(ArgumentError) + -> { Set[].proper_superset?(1) }.should raise_error(ArgumentError) + -> { Set[].proper_superset?("test") }.should raise_error(ArgumentError) + -> { Set[].proper_superset?(Object.new) }.should raise_error(ArgumentError) end context "when comparing to a Set-like object" do diff --git a/spec/ruby/library/set/shared/difference.rb b/spec/ruby/library/set/shared/difference.rb index 52807709c3..f88987ed2a 100644 --- a/spec/ruby/library/set/shared/difference.rb +++ b/spec/ruby/library/set/shared/difference.rb @@ -9,7 +9,7 @@ describe :set_difference, shared: true do end it "raises an ArgumentError when passed a non-Enumerable" do - lambda { @set.send(@method, 1) }.should raise_error(ArgumentError) - lambda { @set.send(@method, Object.new) }.should raise_error(ArgumentError) + -> { @set.send(@method, 1) }.should raise_error(ArgumentError) + -> { @set.send(@method, Object.new) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/shared/intersection.rb b/spec/ruby/library/set/shared/intersection.rb index ed0db7457d..5ae4199c94 100644 --- a/spec/ruby/library/set/shared/intersection.rb +++ b/spec/ruby/library/set/shared/intersection.rb @@ -9,7 +9,7 @@ describe :set_intersection, shared: true do end it "raises an ArgumentError when passed a non-Enumerable" do - lambda { @set.send(@method, 1) }.should raise_error(ArgumentError) - lambda { @set.send(@method, Object.new) }.should raise_error(ArgumentError) + -> { @set.send(@method, 1) }.should raise_error(ArgumentError) + -> { @set.send(@method, Object.new) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/shared/union.rb b/spec/ruby/library/set/shared/union.rb index 81920f5687..314f0e852d 100644 --- a/spec/ruby/library/set/shared/union.rb +++ b/spec/ruby/library/set/shared/union.rb @@ -9,7 +9,7 @@ describe :set_union, shared: true do end it "raises an ArgumentError when passed a non-Enumerable" do - lambda { @set.send(@method, 1) }.should raise_error(ArgumentError) - lambda { @set.send(@method, Object.new) }.should raise_error(ArgumentError) + -> { @set.send(@method, 1) }.should raise_error(ArgumentError) + -> { @set.send(@method, Object.new) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/sortedset/add_spec.rb b/spec/ruby/library/set/sortedset/add_spec.rb index 721ac7fac0..5f8bde02f5 100644 --- a/spec/ruby/library/set/sortedset/add_spec.rb +++ b/spec/ruby/library/set/sortedset/add_spec.rb @@ -8,13 +8,13 @@ describe "SortedSet#add" do it "takes only values which responds <=>" do obj = mock('no_comparison_operator') obj.stub!(:respond_to?).with(:<=>).and_return(false) - lambda { SortedSet["hello"].add(obj) }.should raise_error(ArgumentError) + -> { SortedSet["hello"].add(obj) }.should raise_error(ArgumentError) end it "raises on incompatible <=> comparison" do # Use #to_a here as elements are sorted only when needed. # Therefore the <=> incompatibility is only noticed on sorting. - lambda { SortedSet['1', '2'].add(3).to_a }.should raise_error(ArgumentError) + -> { SortedSet['1', '2'].add(3).to_a }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/sortedset/exclusion_spec.rb b/spec/ruby/library/set/sortedset/exclusion_spec.rb index 59f9f1dfd8..d0f1ab95cb 100644 --- a/spec/ruby/library/set/sortedset/exclusion_spec.rb +++ b/spec/ruby/library/set/sortedset/exclusion_spec.rb @@ -12,7 +12,7 @@ describe "SortedSet#^" do end it "raises an ArgumentError when passed a non-Enumerable" do - lambda { @set ^ 3 }.should raise_error(ArgumentError) - lambda { @set ^ Object.new }.should raise_error(ArgumentError) + -> { @set ^ 3 }.should raise_error(ArgumentError) + -> { @set ^ Object.new }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/sortedset/initialize_spec.rb b/spec/ruby/library/set/sortedset/initialize_spec.rb index cdf756f6b8..1238f4efc4 100644 --- a/spec/ruby/library/set/sortedset/initialize_spec.rb +++ b/spec/ruby/library/set/sortedset/initialize_spec.rb @@ -25,6 +25,6 @@ describe "SortedSet#initialize" do it "raises on incompatible <=> comparison" do # Use #to_a here as elements are sorted only when needed. # Therefore the <=> incompatibility is only noticed on sorting. - lambda { SortedSet.new(['00', nil]).to_a }.should raise_error(ArgumentError) + -> { SortedSet.new(['00', nil]).to_a }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/sortedset/merge_spec.rb b/spec/ruby/library/set/sortedset/merge_spec.rb index f98f2c83ce..31570ad4db 100644 --- a/spec/ruby/library/set/sortedset/merge_spec.rb +++ b/spec/ruby/library/set/sortedset/merge_spec.rb @@ -13,7 +13,7 @@ describe "SortedSet#merge" do end it "raises an ArgumentError when passed a non-Enumerable" do - lambda { SortedSet[1, 2].merge(1) }.should raise_error(ArgumentError) - lambda { SortedSet[1, 2].merge(Object.new) }.should raise_error(ArgumentError) + -> { SortedSet[1, 2].merge(1) }.should raise_error(ArgumentError) + -> { SortedSet[1, 2].merge(Object.new) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/sortedset/proper_subset_spec.rb b/spec/ruby/library/set/sortedset/proper_subset_spec.rb index 3b3c2e5c4c..818173a7f9 100644 --- a/spec/ruby/library/set/sortedset/proper_subset_spec.rb +++ b/spec/ruby/library/set/sortedset/proper_subset_spec.rb @@ -25,9 +25,9 @@ describe "SortedSet#proper_subset?" do end it "raises an ArgumentError when passed a non-SortedSet" do - lambda { SortedSet[].proper_subset?([]) }.should raise_error(ArgumentError) - lambda { SortedSet[].proper_subset?(1) }.should raise_error(ArgumentError) - lambda { SortedSet[].proper_subset?("test") }.should raise_error(ArgumentError) - lambda { SortedSet[].proper_subset?(Object.new) }.should raise_error(ArgumentError) + -> { SortedSet[].proper_subset?([]) }.should raise_error(ArgumentError) + -> { SortedSet[].proper_subset?(1) }.should raise_error(ArgumentError) + -> { SortedSet[].proper_subset?("test") }.should raise_error(ArgumentError) + -> { SortedSet[].proper_subset?(Object.new) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/sortedset/proper_superset_spec.rb b/spec/ruby/library/set/sortedset/proper_superset_spec.rb index 72ae71e2f1..2699290f0e 100644 --- a/spec/ruby/library/set/sortedset/proper_superset_spec.rb +++ b/spec/ruby/library/set/sortedset/proper_superset_spec.rb @@ -25,9 +25,9 @@ describe "SortedSet#proper_superset?" do end it "raises an ArgumentError when passed a non-SortedSet" do - lambda { SortedSet[].proper_superset?([]) }.should raise_error(ArgumentError) - lambda { SortedSet[].proper_superset?(1) }.should raise_error(ArgumentError) - lambda { SortedSet[].proper_superset?("test") }.should raise_error(ArgumentError) - lambda { SortedSet[].proper_superset?(Object.new) }.should raise_error(ArgumentError) + -> { SortedSet[].proper_superset?([]) }.should raise_error(ArgumentError) + -> { SortedSet[].proper_superset?(1) }.should raise_error(ArgumentError) + -> { SortedSet[].proper_superset?("test") }.should raise_error(ArgumentError) + -> { SortedSet[].proper_superset?(Object.new) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/sortedset/shared/difference.rb b/spec/ruby/library/set/sortedset/shared/difference.rb index cf50ff0eb2..688e23a7a7 100644 --- a/spec/ruby/library/set/sortedset/shared/difference.rb +++ b/spec/ruby/library/set/sortedset/shared/difference.rb @@ -9,7 +9,7 @@ describe :sorted_set_difference, shared: true do end it "raises an ArgumentError when passed a non-Enumerable" do - lambda { @set.send(@method, 1) }.should raise_error(ArgumentError) - lambda { @set.send(@method, Object.new) }.should raise_error(ArgumentError) + -> { @set.send(@method, 1) }.should raise_error(ArgumentError) + -> { @set.send(@method, Object.new) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/sortedset/shared/intersection.rb b/spec/ruby/library/set/sortedset/shared/intersection.rb index d3cfa96656..045716ad05 100644 --- a/spec/ruby/library/set/sortedset/shared/intersection.rb +++ b/spec/ruby/library/set/sortedset/shared/intersection.rb @@ -9,7 +9,7 @@ describe :sorted_set_intersection, shared: true do end it "raises an ArgumentError when passed a non-Enumerable" do - lambda { @set.send(@method, 1) }.should raise_error(ArgumentError) - lambda { @set.send(@method, Object.new) }.should raise_error(ArgumentError) + -> { @set.send(@method, 1) }.should raise_error(ArgumentError) + -> { @set.send(@method, Object.new) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/sortedset/shared/union.rb b/spec/ruby/library/set/sortedset/shared/union.rb index 4ff07ef5cc..9015bdc8e3 100644 --- a/spec/ruby/library/set/sortedset/shared/union.rb +++ b/spec/ruby/library/set/sortedset/shared/union.rb @@ -9,7 +9,7 @@ describe :sorted_set_union, shared: true do end it "raises an ArgumentError when passed a non-Enumerable" do - lambda { @set.send(@method, 1) }.should raise_error(ArgumentError) - lambda { @set.send(@method, Object.new) }.should raise_error(ArgumentError) + -> { @set.send(@method, 1) }.should raise_error(ArgumentError) + -> { @set.send(@method, Object.new) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/sortedset/subset_spec.rb b/spec/ruby/library/set/sortedset/subset_spec.rb index cdada2cdfb..7768692df6 100644 --- a/spec/ruby/library/set/sortedset/subset_spec.rb +++ b/spec/ruby/library/set/sortedset/subset_spec.rb @@ -25,9 +25,9 @@ describe "SortedSet#subset?" do end it "raises an ArgumentError when passed a non-SortedSet" do - lambda { SortedSet[].subset?([]) }.should raise_error(ArgumentError) - lambda { SortedSet[].subset?(1) }.should raise_error(ArgumentError) - lambda { SortedSet[].subset?("test") }.should raise_error(ArgumentError) - lambda { SortedSet[].subset?(Object.new) }.should raise_error(ArgumentError) + -> { SortedSet[].subset?([]) }.should raise_error(ArgumentError) + -> { SortedSet[].subset?(1) }.should raise_error(ArgumentError) + -> { SortedSet[].subset?("test") }.should raise_error(ArgumentError) + -> { SortedSet[].subset?(Object.new) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/sortedset/superset_spec.rb b/spec/ruby/library/set/sortedset/superset_spec.rb index 663b179a0c..823781b860 100644 --- a/spec/ruby/library/set/sortedset/superset_spec.rb +++ b/spec/ruby/library/set/sortedset/superset_spec.rb @@ -25,9 +25,9 @@ describe "SortedSet#superset?" do end it "raises an ArgumentError when passed a non-SortedSet" do - lambda { SortedSet[].superset?([]) }.should raise_error(ArgumentError) - lambda { SortedSet[].superset?(1) }.should raise_error(ArgumentError) - lambda { SortedSet[].superset?("test") }.should raise_error(ArgumentError) - lambda { SortedSet[].superset?(Object.new) }.should raise_error(ArgumentError) + -> { SortedSet[].superset?([]) }.should raise_error(ArgumentError) + -> { SortedSet[].superset?(1) }.should raise_error(ArgumentError) + -> { SortedSet[].superset?("test") }.should raise_error(ArgumentError) + -> { SortedSet[].superset?(Object.new) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/set/subset_spec.rb b/spec/ruby/library/set/subset_spec.rb index a1aed45ad0..f375efa6df 100644 --- a/spec/ruby/library/set/subset_spec.rb +++ b/spec/ruby/library/set/subset_spec.rb @@ -27,10 +27,10 @@ describe "Set#subset?" do end it "raises an ArgumentError when passed a non-Set" do - lambda { Set[].subset?([]) }.should raise_error(ArgumentError) - lambda { Set[].subset?(1) }.should raise_error(ArgumentError) - lambda { Set[].subset?("test") }.should raise_error(ArgumentError) - lambda { Set[].subset?(Object.new) }.should raise_error(ArgumentError) + -> { Set[].subset?([]) }.should raise_error(ArgumentError) + -> { Set[].subset?(1) }.should raise_error(ArgumentError) + -> { Set[].subset?("test") }.should raise_error(ArgumentError) + -> { Set[].subset?(Object.new) }.should raise_error(ArgumentError) end context "when comparing to a Set-like object" do diff --git a/spec/ruby/library/set/superset_spec.rb b/spec/ruby/library/set/superset_spec.rb index 1336975a9b..bd9d2f3eee 100644 --- a/spec/ruby/library/set/superset_spec.rb +++ b/spec/ruby/library/set/superset_spec.rb @@ -27,10 +27,10 @@ describe "Set#superset?" do end it "raises an ArgumentError when passed a non-Set" do - lambda { Set[].superset?([]) }.should raise_error(ArgumentError) - lambda { Set[].superset?(1) }.should raise_error(ArgumentError) - lambda { Set[].superset?("test") }.should raise_error(ArgumentError) - lambda { Set[].superset?(Object.new) }.should raise_error(ArgumentError) + -> { Set[].superset?([]) }.should raise_error(ArgumentError) + -> { Set[].superset?(1) }.should raise_error(ArgumentError) + -> { Set[].superset?("test") }.should raise_error(ArgumentError) + -> { Set[].superset?(Object.new) }.should raise_error(ArgumentError) end context "when comparing to a Set-like object" do diff --git a/spec/ruby/library/shellwords/shellwords_spec.rb b/spec/ruby/library/shellwords/shellwords_spec.rb index bb6bcb3d30..2975fd9974 100644 --- a/spec/ruby/library/shellwords/shellwords_spec.rb +++ b/spec/ruby/library/shellwords/shellwords_spec.rb @@ -20,11 +20,11 @@ describe "Shellwords#shellwords" do end it "raises ArgumentError when double quoted strings are misquoted" do - lambda { shellwords('a "b c d e') }.should raise_error(ArgumentError) + -> { shellwords('a "b c d e') }.should raise_error(ArgumentError) end it "raises ArgumentError when single quoted strings are misquoted" do - lambda { shellwords("a 'b c d e") }.should raise_error(ArgumentError) + -> { shellwords("a 'b c d e") }.should raise_error(ArgumentError) end # https://bugs.ruby-lang.org/issues/10055 diff --git a/spec/ruby/library/singleton/allocate_spec.rb b/spec/ruby/library/singleton/allocate_spec.rb index 689ecc57c6..6a1512d53b 100644 --- a/spec/ruby/library/singleton/allocate_spec.rb +++ b/spec/ruby/library/singleton/allocate_spec.rb @@ -3,6 +3,6 @@ require_relative 'fixtures/classes' describe "Singleton.allocate" do it "is a private method" do - lambda { SingletonSpecs::MyClass.allocate }.should raise_error(NoMethodError) + -> { SingletonSpecs::MyClass.allocate }.should raise_error(NoMethodError) end end diff --git a/spec/ruby/library/singleton/clone_spec.rb b/spec/ruby/library/singleton/clone_spec.rb index 7392d7ff6e..3635bcd594 100644 --- a/spec/ruby/library/singleton/clone_spec.rb +++ b/spec/ruby/library/singleton/clone_spec.rb @@ -3,6 +3,6 @@ require_relative 'fixtures/classes' describe "Singleton#clone" do it "is prevented" do - lambda { SingletonSpecs::MyClass.instance.clone }.should raise_error(TypeError) + -> { SingletonSpecs::MyClass.instance.clone }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/singleton/dup_spec.rb b/spec/ruby/library/singleton/dup_spec.rb index c5c02a0357..13d5a213e9 100644 --- a/spec/ruby/library/singleton/dup_spec.rb +++ b/spec/ruby/library/singleton/dup_spec.rb @@ -3,6 +3,6 @@ require_relative 'fixtures/classes' describe "Singleton#dup" do it "is prevented" do - lambda { SingletonSpecs::MyClass.instance.dup }.should raise_error(TypeError) + -> { SingletonSpecs::MyClass.instance.dup }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/singleton/new_spec.rb b/spec/ruby/library/singleton/new_spec.rb index babd50fbc3..2f45db819c 100644 --- a/spec/ruby/library/singleton/new_spec.rb +++ b/spec/ruby/library/singleton/new_spec.rb @@ -3,6 +3,6 @@ require_relative 'fixtures/classes' describe "Singleton.new" do it "is a private method" do - lambda { SingletonSpecs::NewSpec.new }.should raise_error(NoMethodError) + -> { SingletonSpecs::NewSpec.new }.should raise_error(NoMethodError) end end diff --git a/spec/ruby/library/socket/addrinfo/family_addrinfo_spec.rb b/spec/ruby/library/socket/addrinfo/family_addrinfo_spec.rb index d3419daaaf..2bc3b6a2e3 100644 --- a/spec/ruby/library/socket/addrinfo/family_addrinfo_spec.rb +++ b/spec/ruby/library/socket/addrinfo/family_addrinfo_spec.rb @@ -4,7 +4,7 @@ describe 'Addrinfo#family_addrinfo' do it 'raises ArgumentError if no arguments are given' do addr = Addrinfo.tcp('127.0.0.1', 0) - lambda { addr.family_addrinfo }.should raise_error(ArgumentError) + -> { addr.family_addrinfo }.should raise_error(ArgumentError) end describe 'using multiple arguments' do @@ -14,11 +14,11 @@ describe 'Addrinfo#family_addrinfo' do end it 'raises ArgumentError if only 1 argument is given' do - lambda { @source.family_addrinfo('127.0.0.1') }.should raise_error(ArgumentError) + -> { @source.family_addrinfo('127.0.0.1') }.should raise_error(ArgumentError) end it 'raises ArgumentError if more than 2 arguments are given' do - lambda { @source.family_addrinfo('127.0.0.1', 0, 666) }.should raise_error(ArgumentError) + -> { @source.family_addrinfo('127.0.0.1', 0, 666) }.should raise_error(ArgumentError) end it 'returns an Addrinfo when a host and port are given' do @@ -57,7 +57,7 @@ describe 'Addrinfo#family_addrinfo' do end it 'raises ArgumentError if more than 1 argument is given' do - lambda { @source.family_addrinfo('foo', 'bar') }.should raise_error(ArgumentError) + -> { @source.family_addrinfo('foo', 'bar') }.should raise_error(ArgumentError) end it 'returns an Addrinfo when a UNIX socket path is given' do @@ -99,17 +99,17 @@ describe 'Addrinfo#family_addrinfo' do it 'raises ArgumentError if more than 1 argument is given' do input = Addrinfo.tcp('127.0.0.2', 0) - lambda { @source.family_addrinfo(input, 666) }.should raise_error(ArgumentError) + -> { @source.family_addrinfo(input, 666) }.should raise_error(ArgumentError) end it "raises ArgumentError if the protocol families don't match" do input = Addrinfo.tcp('::1', 0) - lambda { @source.family_addrinfo(input) }.should raise_error(ArgumentError) + -> { @source.family_addrinfo(input) }.should raise_error(ArgumentError) end it "raises ArgumentError if the socket types don't match" do input = Addrinfo.udp('127.0.0.1', 0) - lambda { @source.family_addrinfo(input) }.should raise_error(ArgumentError) + -> { @source.family_addrinfo(input) }.should raise_error(ArgumentError) end end end diff --git a/spec/ruby/library/socket/addrinfo/initialize_spec.rb b/spec/ruby/library/socket/addrinfo/initialize_spec.rb index 460fc28d49..8354553f61 100644 --- a/spec/ruby/library/socket/addrinfo/initialize_spec.rb +++ b/spec/ruby/library/socket/addrinfo/initialize_spec.rb @@ -198,7 +198,7 @@ describe "Addrinfo#initialize" do describe 'with an invalid IP address' do it 'raises SocketError' do - block = lambda { Addrinfo.new(['AF_INET6', 80, 'hostname', '127.0.0.1']) } + block = -> { Addrinfo.new(['AF_INET6', 80, 'hostname', '127.0.0.1']) } block.should raise_error(SocketError) end @@ -290,7 +290,7 @@ describe "Addrinfo#initialize" do it "raises SocketError when using SOCK_RDM" do sockaddr = ['AF_INET', 80, 'hostname', '127.0.0.1'] value = Socket::SOCK_RDM - block = lambda { Addrinfo.new(sockaddr, nil, value) } + block = -> { Addrinfo.new(sockaddr, nil, value) } block.should raise_error(SocketError) end @@ -364,7 +364,7 @@ describe "Addrinfo#initialize" do (Socket.constants.grep(/^IPPROTO/) - valid).each do |type| it "raises SocketError when using #{type}" do value = Socket.const_get(type) - block = lambda { Addrinfo.new(@sockaddr, nil, nil, value) } + block = -> { Addrinfo.new(@sockaddr, nil, nil, value) } block.should raise_error(SocketError) end @@ -392,7 +392,7 @@ describe "Addrinfo#initialize" do (Socket.constants.grep(/^IPPROTO/) - valid).each do |type| it "raises SocketError when using #{type}" do value = Socket.const_get(type) - block = lambda { Addrinfo.new(@sockaddr, nil, @socktype, value) } + block = -> { Addrinfo.new(@sockaddr, nil, @socktype, value) } block.should raise_error(SocketError) end @@ -409,7 +409,7 @@ describe "Addrinfo#initialize" do Socket.constants.grep(/^IPPROTO/).each do |type| it "raises SocketError when using #{type}" do value = Socket.const_get(type) - block = lambda { Addrinfo.new(@sockaddr, nil, @socktype, value) } + block = -> { Addrinfo.new(@sockaddr, nil, @socktype, value) } block.should raise_error(SocketError) end @@ -440,7 +440,7 @@ describe "Addrinfo#initialize" do Socket.constants.grep(/^IPPROTO/).each do |type| it "raises SocketError when using #{type}" do value = Socket.const_get(type) - block = lambda { Addrinfo.new(@sockaddr, nil, @socktype, value) } + block = -> { Addrinfo.new(@sockaddr, nil, @socktype, value) } block.should raise_error(SocketError) end @@ -467,7 +467,7 @@ describe "Addrinfo#initialize" do (Socket.constants.grep(/^IPPROTO/) - valid).each do |type| it "raises SocketError when using #{type}" do value = Socket.const_get(type) - block = lambda { Addrinfo.new(@sockaddr, nil, @socktype, value) } + block = -> { Addrinfo.new(@sockaddr, nil, @socktype, value) } block.should raise_error(SocketError) end @@ -495,7 +495,7 @@ describe "Addrinfo#initialize" do (Socket.constants.grep(/^IPPROTO/) - valid).each do |type| it "raises SocketError when using #{type}" do value = Socket.const_get(type) - block = lambda { Addrinfo.new(@sockaddr, nil, @socktype, value) } + block = -> { Addrinfo.new(@sockaddr, nil, @socktype, value) } block.should raise_error(SocketError) end diff --git a/spec/ruby/library/socket/addrinfo/ip_address_spec.rb b/spec/ruby/library/socket/addrinfo/ip_address_spec.rb index d53c00267a..4522cf5cfd 100644 --- a/spec/ruby/library/socket/addrinfo/ip_address_spec.rb +++ b/spec/ruby/library/socket/addrinfo/ip_address_spec.rb @@ -28,7 +28,7 @@ describe "Addrinfo#ip_address" do end it "raises an exception" do - lambda { @addrinfo.ip_address }.should raise_error(SocketError) + -> { @addrinfo.ip_address }.should raise_error(SocketError) end end end diff --git a/spec/ruby/library/socket/addrinfo/ip_port_spec.rb b/spec/ruby/library/socket/addrinfo/ip_port_spec.rb index 6cf9e7a18e..4118607db0 100644 --- a/spec/ruby/library/socket/addrinfo/ip_port_spec.rb +++ b/spec/ruby/library/socket/addrinfo/ip_port_spec.rb @@ -28,7 +28,7 @@ describe "Addrinfo#ip_port" do end it "raises an exception" do - lambda { @addrinfo.ip_port }.should raise_error(SocketError) + -> { @addrinfo.ip_port }.should raise_error(SocketError) end end end diff --git a/spec/ruby/library/socket/addrinfo/ip_unpack_spec.rb b/spec/ruby/library/socket/addrinfo/ip_unpack_spec.rb index 57ae79a6c8..6c81c48d1c 100644 --- a/spec/ruby/library/socket/addrinfo/ip_unpack_spec.rb +++ b/spec/ruby/library/socket/addrinfo/ip_unpack_spec.rb @@ -28,7 +28,7 @@ describe "Addrinfo#ip_unpack" do end it "raises an exception" do - lambda { @addrinfo.ip_unpack }.should raise_error(SocketError) + -> { @addrinfo.ip_unpack }.should raise_error(SocketError) end end end diff --git a/spec/ruby/library/socket/addrinfo/unix_path_spec.rb b/spec/ruby/library/socket/addrinfo/unix_path_spec.rb index 0f25881724..6bfb56a4ac 100644 --- a/spec/ruby/library/socket/addrinfo/unix_path_spec.rb +++ b/spec/ruby/library/socket/addrinfo/unix_path_spec.rb @@ -9,7 +9,7 @@ with_feature :unix_socket do end it "raises an exception" do - lambda { @addrinfo.unix_path }.should raise_error(SocketError) + -> { @addrinfo.unix_path }.should raise_error(SocketError) end end @@ -20,7 +20,7 @@ with_feature :unix_socket do end it "raises an exception" do - lambda { @addrinfo.unix_path }.should raise_error(SocketError) + -> { @addrinfo.unix_path }.should raise_error(SocketError) end end diff --git a/spec/ruby/library/socket/ancillarydata/cmsg_is_spec.rb b/spec/ruby/library/socket/ancillarydata/cmsg_is_spec.rb index 50763e28b1..c54ee29825 100644 --- a/spec/ruby/library/socket/ancillarydata/cmsg_is_spec.rb +++ b/spec/ruby/library/socket/ancillarydata/cmsg_is_spec.rb @@ -26,7 +26,7 @@ with_feature :ancillary_data do end it 'raises SocketError when comparing with :IPV6 and :RIGHTS' do - lambda { @data.cmsg_is?(:IPV6, :RIGHTS) }.should raise_error(SocketError) + -> { @data.cmsg_is?(:IPV6, :RIGHTS) }.should raise_error(SocketError) end end end diff --git a/spec/ruby/library/socket/ancillarydata/initialize_spec.rb b/spec/ruby/library/socket/ancillarydata/initialize_spec.rb index d4788d0f68..344d1485c5 100644 --- a/spec/ruby/library/socket/ancillarydata/initialize_spec.rb +++ b/spec/ruby/library/socket/ancillarydata/initialize_spec.rb @@ -113,25 +113,25 @@ with_feature :ancillary_data do end it 'raises TypeError when using a numeric string as the type argument' do - lambda { + -> { Socket::AncillaryData.new(:INET, :IGMP, Socket::SCM_RIGHTS.to_s, '') }.should raise_error(TypeError) end it 'raises SocketError when using :RECVTTL as the type argument' do - lambda { + -> { Socket::AncillaryData.new(:INET, :SOCKET, :RECVTTL, '') }.should raise_error(SocketError) end it 'raises SocketError when using :MOO as the type argument' do - lambda { + -> { Socket::AncillaryData.new(:INET, :SOCKET, :MOO, '') }.should raise_error(SocketError) end it 'raises SocketError when using :IP_RECVTTL as the type argument' do - lambda { + -> { Socket::AncillaryData.new(:INET, :SOCKET, :IP_RECVTTL, '') }.should raise_error(SocketError) end @@ -155,13 +155,13 @@ with_feature :ancillary_data do end it 'raises SocketError when using :RIGHTS as the type argument' do - lambda { + -> { Socket::AncillaryData.new(:INET, :IP, :RIGHTS, '') }.should raise_error(SocketError) end it 'raises SocketError when using :MOO as the type argument' do - lambda { + -> { Socket::AncillaryData.new(:INET, :IP, :MOO, '') }.should raise_error(SocketError) end @@ -179,13 +179,13 @@ with_feature :ancillary_data do end it 'raises SocketError when using :RIGHTS as the type argument' do - lambda { + -> { Socket::AncillaryData.new(:INET, :IPV6, :RIGHTS, '') }.should raise_error(SocketError) end it 'raises SocketError when using :MOO as the type argument' do - lambda { + -> { Socket::AncillaryData.new(:INET, :IPV6, :MOO, '') }.should raise_error(SocketError) end @@ -205,13 +205,13 @@ with_feature :ancillary_data do end it 'raises SocketError when using :RIGHTS as the type argument' do - lambda { + -> { Socket::AncillaryData.new(:INET, :TCP, :RIGHTS, '') }.should raise_error(SocketError) end it 'raises SocketError when using :MOO as the type argument' do - lambda { + -> { Socket::AncillaryData.new(:INET, :TCP, :MOO, '') }.should raise_error(SocketError) end @@ -225,13 +225,13 @@ with_feature :ancillary_data do end it 'raises SocketError when using :RIGHTS as the type argument' do - lambda { + -> { Socket::AncillaryData.new(:INET, :UDP, :RIGHTS, '') }.should raise_error(SocketError) end it 'raises SocketError when using :MOO as the type argument' do - lambda { + -> { Socket::AncillaryData.new(:INET, :UDP, :MOO, '') }.should raise_error(SocketError) end @@ -243,7 +243,7 @@ with_feature :ancillary_data do end it 'raises SocketError when using :CORK sa the type argument' do - lambda { + -> { Socket::AncillaryData.new(:UNIX, :SOCKET, :CORK, '') }.should raise_error(SocketError) end @@ -251,7 +251,7 @@ with_feature :ancillary_data do describe 'using :AF_UNIX as the family and :IP as the level' do it 'raises SocketError' do - lambda { + -> { Socket::AncillaryData.new(:UNIX, :IP, :RECVTTL, '') }.should raise_error(SocketError) end @@ -259,7 +259,7 @@ with_feature :ancillary_data do describe 'using :AF_UNIX as the family and :IPV6 as the level' do it 'raises SocketError' do - lambda { + -> { Socket::AncillaryData.new(:UNIX, :IPV6, :NEXTHOP, '') }.should raise_error(SocketError) end @@ -267,7 +267,7 @@ with_feature :ancillary_data do describe 'using :AF_UNIX as the family and :TCP as the level' do it 'raises SocketError' do - lambda { + -> { Socket::AncillaryData.new(:UNIX, :TCP, :CORK, '') }.should raise_error(SocketError) end @@ -275,7 +275,7 @@ with_feature :ancillary_data do describe 'using :AF_UNIX as the family and :UDP as the level' do it 'raises SocketError' do - lambda { + -> { Socket::AncillaryData.new(:UNIX, :UDP, :CORK, '') }.should raise_error(SocketError) end diff --git a/spec/ruby/library/socket/ancillarydata/int_spec.rb b/spec/ruby/library/socket/ancillarydata/int_spec.rb index 0d7c5e3652..fe41a30a1a 100644 --- a/spec/ruby/library/socket/ancillarydata/int_spec.rb +++ b/spec/ruby/library/socket/ancillarydata/int_spec.rb @@ -37,7 +37,7 @@ with_feature :ancillary_data do it 'raises when the data is not an Integer' do data = Socket::AncillaryData.new(:UNIX, :SOCKET, :RIGHTS, 'ugh') - lambda { data.int }.should raise_error(TypeError) + -> { data.int }.should raise_error(TypeError) end end end diff --git a/spec/ruby/library/socket/ancillarydata/ip_pktinfo_spec.rb b/spec/ruby/library/socket/ancillarydata/ip_pktinfo_spec.rb index 9fc4e8c201..84910a038a 100644 --- a/spec/ruby/library/socket/ancillarydata/ip_pktinfo_spec.rb +++ b/spec/ruby/library/socket/ancillarydata/ip_pktinfo_spec.rb @@ -89,7 +89,7 @@ with_feature :ancillary_data, :pktinfo do end it 'is not the same object as the input Addrinfo' do - @addr.should_not.equal? @source + @addr.should_not equal @source end end @@ -109,7 +109,7 @@ with_feature :ancillary_data, :pktinfo do end it 'is not the same object as the input Addrinfo' do - @addr.should_not.equal? @dest + @addr.should_not equal @dest end end end diff --git a/spec/ruby/library/socket/ancillarydata/ipv6_pktinfo_spec.rb b/spec/ruby/library/socket/ancillarydata/ipv6_pktinfo_spec.rb index 6f576f5169..0fffc720dc 100644 --- a/spec/ruby/library/socket/ancillarydata/ipv6_pktinfo_spec.rb +++ b/spec/ruby/library/socket/ancillarydata/ipv6_pktinfo_spec.rb @@ -58,7 +58,7 @@ with_feature :ancillary_data, :ipv6_pktinfo do end it 'is not the same object as the input Addrinfo' do - @addr.should_not.equal? @source + @addr.should_not equal @source end end diff --git a/spec/ruby/library/socket/ancillarydata/unix_rights_spec.rb b/spec/ruby/library/socket/ancillarydata/unix_rights_spec.rb index 34d954af81..65ffcb01af 100644 --- a/spec/ruby/library/socket/ancillarydata/unix_rights_spec.rb +++ b/spec/ruby/library/socket/ancillarydata/unix_rights_spec.rb @@ -26,7 +26,7 @@ with_feature :ancillary_data do describe 'using non IO objects' do it 'raises TypeError' do - lambda { Socket::AncillaryData.unix_rights(10) }.should raise_error(TypeError) + -> { Socket::AncillaryData.unix_rights(10) }.should raise_error(TypeError) end end end @@ -47,14 +47,14 @@ with_feature :ancillary_data do it 'raises TypeError when the level is not SOL_SOCKET' do data = Socket::AncillaryData.new(:INET, :IP, :RECVTTL, '') - lambda { data.unix_rights }.should raise_error(TypeError) + -> { data.unix_rights }.should raise_error(TypeError) end platform_is_not :"solaris2.10", :aix do it 'raises TypeError when the type is not SCM_RIGHTS' do data = Socket::AncillaryData.new(:INET, :SOCKET, :TIMESTAMP, '') - lambda { data.unix_rights }.should raise_error(TypeError) + -> { data.unix_rights }.should raise_error(TypeError) end end end diff --git a/spec/ruby/library/socket/basicsocket/close_read_spec.rb b/spec/ruby/library/socket/basicsocket/close_read_spec.rb index c989fcaf72..f317b34955 100644 --- a/spec/ruby/library/socket/basicsocket/close_read_spec.rb +++ b/spec/ruby/library/socket/basicsocket/close_read_spec.rb @@ -12,13 +12,13 @@ describe "Socket::BasicSocket#close_read" do it "closes the reading end of the socket" do @server.close_read - lambda { @server.read }.should raise_error(IOError) + -> { @server.read }.should raise_error(IOError) end it 'does not raise when called on a socket already closed for reading' do @server.close_read @server.close_read - lambda { @server.read }.should raise_error(IOError) + -> { @server.read }.should raise_error(IOError) end it 'does not fully close the socket' do @@ -34,7 +34,7 @@ describe "Socket::BasicSocket#close_read" do it 'raises IOError when called on a fully closed socket' do @server.close - lambda { @server.close_read }.should raise_error(IOError) + -> { @server.close_read }.should raise_error(IOError) end it "returns nil" do diff --git a/spec/ruby/library/socket/basicsocket/close_write_spec.rb b/spec/ruby/library/socket/basicsocket/close_write_spec.rb index f37e0e5074..232cfbb7c6 100644 --- a/spec/ruby/library/socket/basicsocket/close_write_spec.rb +++ b/spec/ruby/library/socket/basicsocket/close_write_spec.rb @@ -12,13 +12,13 @@ describe "Socket::BasicSocket#close_write" do it "closes the writing end of the socket" do @server.close_write - lambda { @server.write("foo") }.should raise_error(IOError) + -> { @server.write("foo") }.should raise_error(IOError) end it 'does not raise when called on a socket already closed for writing' do @server.close_write @server.close_write - lambda { @server.write("foo") }.should raise_error(IOError) + -> { @server.write("foo") }.should raise_error(IOError) end it 'does not fully close the socket' do @@ -39,7 +39,7 @@ describe "Socket::BasicSocket#close_write" do it 'raises IOError when called on a fully closed socket' do @server.close - lambda { @server.close_write }.should raise_error(IOError) + -> { @server.close_write }.should raise_error(IOError) end it "returns nil" do diff --git a/spec/ruby/library/socket/basicsocket/connect_address_spec.rb b/spec/ruby/library/socket/basicsocket/connect_address_spec.rb index 18baac7f17..1a1c9982d9 100644 --- a/spec/ruby/library/socket/basicsocket/connect_address_spec.rb +++ b/spec/ruby/library/socket/basicsocket/connect_address_spec.rb @@ -10,7 +10,7 @@ describe 'Socket#connect_address' do it 'raises SocketError' do @sock = Socket.new(:INET, :STREAM) - lambda { @sock.connect_address }.should raise_error(SocketError) + -> { @sock.connect_address }.should raise_error(SocketError) end end @@ -110,7 +110,7 @@ describe 'Socket#connect_address' do end it 'raises SocketError' do - lambda { @client.connect_address }.should raise_error(SocketError) + -> { @client.connect_address }.should raise_error(SocketError) end end end diff --git a/spec/ruby/library/socket/basicsocket/getpeereid_spec.rb b/spec/ruby/library/socket/basicsocket/getpeereid_spec.rb index 9eeb6d0e0b..6179211d96 100644 --- a/spec/ruby/library/socket/basicsocket/getpeereid_spec.rb +++ b/spec/ruby/library/socket/basicsocket/getpeereid_spec.rb @@ -30,7 +30,7 @@ describe 'BasicSocket#getpeereid' do it 'raises NoMethodError' do @sock = TCPServer.new('127.0.0.1', 0) - lambda { @sock.getpeereid }.should raise_error(NoMethodError) + -> { @sock.getpeereid }.should raise_error(NoMethodError) end end end diff --git a/spec/ruby/library/socket/basicsocket/getpeername_spec.rb b/spec/ruby/library/socket/basicsocket/getpeername_spec.rb index 23c73056cd..0b93f02eef 100644 --- a/spec/ruby/library/socket/basicsocket/getpeername_spec.rb +++ b/spec/ruby/library/socket/basicsocket/getpeername_spec.rb @@ -20,6 +20,6 @@ describe "Socket::BasicSocket#getpeername" do end it 'raises Errno::ENOTCONN for a disconnected socket' do - lambda { @server.getpeername }.should raise_error(Errno::ENOTCONN) + -> { @server.getpeername }.should raise_error(Errno::ENOTCONN) end end diff --git a/spec/ruby/library/socket/basicsocket/getsockopt_spec.rb b/spec/ruby/library/socket/basicsocket/getsockopt_spec.rb index aad21ca535..ce65d6c92b 100644 --- a/spec/ruby/library/socket/basicsocket/getsockopt_spec.rb +++ b/spec/ruby/library/socket/basicsocket/getsockopt_spec.rb @@ -41,7 +41,7 @@ describe "BasicSocket#getsockopt" do end it "raises a SystemCallError with an invalid socket option" do - lambda { @sock.getsockopt Socket::SOL_SOCKET, -1 }.should raise_error(Errno::ENOPROTOOPT) + -> { @sock.getsockopt Socket::SOL_SOCKET, -1 }.should raise_error(Errno::ENOPROTOOPT) end it 'returns a Socket::Option using a constant' do @@ -69,7 +69,7 @@ describe "BasicSocket#getsockopt" do end it 'raises Errno::ENOPROTOOPT when requesting an invalid option' do - lambda { @sock.getsockopt(Socket::SOL_SOCKET, -1) }.should raise_error(Errno::ENOPROTOOPT) + -> { @sock.getsockopt(Socket::SOL_SOCKET, -1) }.should raise_error(Errno::ENOPROTOOPT) end describe 'using Symbols as arguments' do diff --git a/spec/ruby/library/socket/basicsocket/recv_nonblock_spec.rb b/spec/ruby/library/socket/basicsocket/recv_nonblock_spec.rb index 26683b3d23..0363f2f8de 100644 --- a/spec/ruby/library/socket/basicsocket/recv_nonblock_spec.rb +++ b/spec/ruby/library/socket/basicsocket/recv_nonblock_spec.rb @@ -16,14 +16,14 @@ describe "Socket::BasicSocket#recv_nonblock" do platform_is_not :windows do describe 'using an unbound socket' do it 'raises an exception extending IO::WaitReadable' do - lambda { @s1.recv_nonblock(1) }.should raise_error(IO::WaitReadable) + -> { @s1.recv_nonblock(1) }.should raise_error(IO::WaitReadable) end end end it "raises an exception extending IO::WaitReadable if there's no data available" do @s1.bind(Socket.pack_sockaddr_in(0, ip_address)) - lambda { + -> { @s1.recv_nonblock(5) }.should raise_error(IO::WaitReadable) { |e| platform_is_not :windows do @@ -62,7 +62,7 @@ describe "Socket::BasicSocket#recv_nonblock" do @s2.send("a", 0, @s1.getsockname) IO.select([@s1], nil, nil, 2) @s1.recv_nonblock(1).should == "a" - lambda { + -> { @s1.recv_nonblock(5) }.should raise_error(IO::WaitReadable) end diff --git a/spec/ruby/library/socket/basicsocket/recv_spec.rb b/spec/ruby/library/socket/basicsocket/recv_spec.rb index a277dc2d97..b6ccda5d00 100644 --- a/spec/ruby/library/socket/basicsocket/recv_spec.rb +++ b/spec/ruby/library/socket/basicsocket/recv_spec.rb @@ -107,7 +107,7 @@ describe 'BasicSocket#recv' do describe 'using an unbound socket' do it 'blocks the caller' do - lambda { @server.recv(4) }.should block_caller + -> { @server.recv(4) }.should block_caller end end @@ -118,7 +118,7 @@ describe 'BasicSocket#recv' do describe 'without any data available' do it 'blocks the caller' do - lambda { @server.recv(4) }.should block_caller + -> { @server.recv(4) }.should block_caller end end @@ -144,7 +144,7 @@ describe 'BasicSocket#recv' do @server.recv(2).should == 'he' - lambda { @server.recv(4) }.should block_caller + -> { @server.recv(4) }.should block_caller end it 'takes a peek at the data when using the MSG_PEEK flag' do diff --git a/spec/ruby/library/socket/basicsocket/recvmsg_nonblock_spec.rb b/spec/ruby/library/socket/basicsocket/recvmsg_nonblock_spec.rb index c440bac8bf..8e6c232c59 100644 --- a/spec/ruby/library/socket/basicsocket/recvmsg_nonblock_spec.rb +++ b/spec/ruby/library/socket/basicsocket/recvmsg_nonblock_spec.rb @@ -17,7 +17,7 @@ describe 'BasicSocket#recvmsg_nonblock' do platform_is_not :windows do describe 'using an unbound socket' do it 'raises an exception extending IO::WaitReadable' do - lambda { @server.recvmsg_nonblock }.should raise_error(IO::WaitReadable) + -> { @server.recvmsg_nonblock }.should raise_error(IO::WaitReadable) end end end @@ -29,7 +29,7 @@ describe 'BasicSocket#recvmsg_nonblock' do describe 'without any data available' do it 'raises an exception extending IO::WaitReadable' do - lambda { @server.recvmsg_nonblock }.should raise_error(IO::WaitReadable) + -> { @server.recvmsg_nonblock }.should raise_error(IO::WaitReadable) end it 'returns :wait_readable with exception: false' do @@ -132,7 +132,7 @@ describe 'BasicSocket#recvmsg_nonblock' do describe 'without any data available' do it 'raises IO::WaitReadable' do - lambda { + -> { socket, _ = @server.accept begin socket.recvmsg_nonblock @@ -182,7 +182,7 @@ describe 'BasicSocket#recvmsg_nonblock' do end it 'raises when receiving the ip_address message' do - lambda { @addr.ip_address }.should raise_error(SocketError) + -> { @addr.ip_address }.should raise_error(SocketError) end it 'uses the correct address family' do @@ -198,7 +198,7 @@ describe 'BasicSocket#recvmsg_nonblock' do end it 'raises when receiving the ip_port message' do - lambda { @addr.ip_port }.should raise_error(SocketError) + -> { @addr.ip_port }.should raise_error(SocketError) end end end diff --git a/spec/ruby/library/socket/basicsocket/recvmsg_spec.rb b/spec/ruby/library/socket/basicsocket/recvmsg_spec.rb index 58eb8d0360..8063723701 100644 --- a/spec/ruby/library/socket/basicsocket/recvmsg_spec.rb +++ b/spec/ruby/library/socket/basicsocket/recvmsg_spec.rb @@ -17,7 +17,7 @@ describe 'BasicSocket#recvmsg' do platform_is_not :windows do describe 'using an unbound socket' do it 'blocks the caller' do - lambda { @server.recvmsg }.should block_caller + -> { @server.recvmsg }.should block_caller end end end @@ -29,7 +29,7 @@ describe 'BasicSocket#recvmsg' do describe 'without any data available' do it 'blocks the caller' do - lambda { @server.recvmsg }.should block_caller + -> { @server.recvmsg }.should block_caller end end @@ -126,7 +126,7 @@ describe 'BasicSocket#recvmsg' do it 'blocks the caller' do socket, _ = @server.accept begin - lambda { socket.recvmsg }.should block_caller + -> { socket.recvmsg }.should block_caller ensure socket.close end @@ -170,7 +170,7 @@ describe 'BasicSocket#recvmsg' do end it 'raises when receiving the ip_address message' do - lambda { @addr.ip_address }.should raise_error(SocketError) + -> { @addr.ip_address }.should raise_error(SocketError) end it 'uses the correct address family' do @@ -186,7 +186,7 @@ describe 'BasicSocket#recvmsg' do end it 'raises when receiving the ip_port message' do - lambda { @addr.ip_port }.should raise_error(SocketError) + -> { @addr.ip_port }.should raise_error(SocketError) end end end diff --git a/spec/ruby/library/socket/basicsocket/send_spec.rb b/spec/ruby/library/socket/basicsocket/send_spec.rb index c4845fc09e..041ee46998 100644 --- a/spec/ruby/library/socket/basicsocket/send_spec.rb +++ b/spec/ruby/library/socket/basicsocket/send_spec.rb @@ -101,7 +101,7 @@ describe 'BasicSocket#send' do describe 'without a destination address' do it "raises #{SocketSpecs.dest_addr_req_error}" do - lambda { @client.send('hello', 0) }.should raise_error(SocketSpecs.dest_addr_req_error) + -> { @client.send('hello', 0) }.should raise_error(SocketSpecs.dest_addr_req_error) end end @@ -113,7 +113,7 @@ describe 'BasicSocket#send' do it 'does not persist the connection after writing to the socket' do @client.send('hello', 0, @server.getsockname) - lambda { @client.send('hello', 0) }.should raise_error(SocketSpecs.dest_addr_req_error) + -> { @client.send('hello', 0) }.should raise_error(SocketSpecs.dest_addr_req_error) end end @@ -161,7 +161,7 @@ describe 'BasicSocket#send' do it 'sends the message to the given address instead' do @client.send('hello', 0, @alt_server.getsockname).should == 5 - lambda { @server.recv(5) }.should block_caller + -> { @server.recv(5) }.should block_caller @alt_server.recv(5).should == 'hello' end diff --git a/spec/ruby/library/socket/basicsocket/sendmsg_nonblock_spec.rb b/spec/ruby/library/socket/basicsocket/sendmsg_nonblock_spec.rb index 000971f6af..c112f2ab4a 100644 --- a/spec/ruby/library/socket/basicsocket/sendmsg_nonblock_spec.rb +++ b/spec/ruby/library/socket/basicsocket/sendmsg_nonblock_spec.rb @@ -18,7 +18,7 @@ describe 'BasicSocket#sendmsg_nonblock' do describe 'without a destination address' do it "raises #{SocketSpecs.dest_addr_req_error}" do - lambda { @client.sendmsg_nonblock('hello') }.should raise_error(SocketSpecs.dest_addr_req_error) + -> { @client.sendmsg_nonblock('hello') }.should raise_error(SocketSpecs.dest_addr_req_error) end end @@ -70,7 +70,7 @@ describe 'BasicSocket#sendmsg_nonblock' do it 'sends the message to the given address instead' do @client.sendmsg_nonblock('hello', 0, @alt_server.getsockname).should == 5 - lambda { @server.recv(5) }.should block_caller + -> { @server.recv(5) }.should block_caller @alt_server.recv(5).should == 'hello' end end @@ -94,7 +94,7 @@ describe 'BasicSocket#sendmsg_nonblock' do end it 'raises IO::WaitWritable when the underlying buffer is full' do - lambda { + -> { 10.times { @client.sendmsg_nonblock('hello' * 1_000_000) } }.should raise_error(IO::WaitWritable) end diff --git a/spec/ruby/library/socket/basicsocket/sendmsg_spec.rb b/spec/ruby/library/socket/basicsocket/sendmsg_spec.rb index f2c11f443a..7ff336c0b7 100644 --- a/spec/ruby/library/socket/basicsocket/sendmsg_spec.rb +++ b/spec/ruby/library/socket/basicsocket/sendmsg_spec.rb @@ -19,7 +19,7 @@ describe 'BasicSocket#sendmsg' do platform_is_not :windows do describe 'without a destination address' do it "raises #{SocketSpecs.dest_addr_req_error}" do - lambda { @client.sendmsg('hello') }.should raise_error(SocketSpecs.dest_addr_req_error) + -> { @client.sendmsg('hello') }.should raise_error(SocketSpecs.dest_addr_req_error) end end end @@ -74,7 +74,7 @@ describe 'BasicSocket#sendmsg' do it 'sends the message to the given address instead' do @client.sendmsg('hello', 0, @alt_server.getsockname).should == 5 - lambda { @server.recv(5) }.should block_caller + -> { @server.recv(5) }.should block_caller @alt_server.recv(5).should == 'hello' end @@ -101,7 +101,7 @@ describe 'BasicSocket#sendmsg' do it 'blocks when the underlying buffer is full' do # Buffer sizes may differ per platform, so sadly this is the only # reliable way of testing blocking behaviour. - lambda do + -> do 10.times { @client.sendmsg('hello' * 1_000_000) } end.should block_caller end diff --git a/spec/ruby/library/socket/basicsocket/setsockopt_spec.rb b/spec/ruby/library/socket/basicsocket/setsockopt_spec.rb index 1471b03798..1e8d84e1c9 100644 --- a/spec/ruby/library/socket/basicsocket/setsockopt_spec.rb +++ b/spec/ruby/library/socket/basicsocket/setsockopt_spec.rb @@ -38,7 +38,7 @@ describe "BasicSocket#setsockopt" do platform_is_not :windows do it "raises EINVAL if passed wrong linger value" do - lambda do + -> do @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_LINGER, 0) end.should raise_error(Errno::EINVAL) end @@ -70,7 +70,7 @@ describe "BasicSocket#setsockopt" do n.should_not == [0].pack("i") platform_is_not :windows do - lambda { + -> { @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE, "") }.should raise_error(SystemCallError) end @@ -80,7 +80,7 @@ describe "BasicSocket#setsockopt" do n.should_not == [0].pack("i") platform_is_not :windows do - lambda { + -> { @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE, "0") }.should raise_error(SystemCallError) end @@ -90,13 +90,13 @@ describe "BasicSocket#setsockopt" do n.should == [0].pack("i") platform_is_not :windows do - lambda { + -> { @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE, "1") }.should raise_error(SystemCallError) end platform_is_not :windows do - lambda { + -> { @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_OOBINLINE, "\x00\x00\x00") }.should raise_error(SystemCallError) end @@ -125,7 +125,7 @@ describe "BasicSocket#setsockopt" do n = @sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF).to_s n.unpack('i')[0].should >= 1 - lambda { + -> { @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, nil).should == 0 }.should raise_error(TypeError) @@ -137,23 +137,23 @@ describe "BasicSocket#setsockopt" do n = @sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF).to_s n.unpack('i')[0].should >= 2 - lambda { + -> { @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, "") }.should raise_error(SystemCallError) - lambda { + -> { @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, "bla") }.should raise_error(SystemCallError) - lambda { + -> { @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, "0") }.should raise_error(SystemCallError) - lambda { + -> { @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, "1") }.should raise_error(SystemCallError) - lambda { + -> { @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, "\x00\x00\x00") }.should raise_error(SystemCallError) @@ -224,7 +224,7 @@ describe 'BasicSocket#setsockopt' do describe 'using separate arguments with Symbols' do it 'raises TypeError when the first argument is nil' do - lambda { @socket.setsockopt(nil, :REUSEADDR, true) }.should raise_error(TypeError) + -> { @socket.setsockopt(nil, :REUSEADDR, true) }.should raise_error(TypeError) end it 'sets a boolean option' do @@ -251,7 +251,7 @@ describe 'BasicSocket#setsockopt' do platform_is_not :windows do it 'raises Errno::EINVAL when setting an invalid option value' do - lambda { @socket.setsockopt(:SOCKET, :OOBINLINE, 'bla') }.should raise_error(Errno::EINVAL) + -> { @socket.setsockopt(:SOCKET, :OOBINLINE, 'bla') }.should raise_error(Errno::EINVAL) end end end @@ -305,12 +305,12 @@ describe 'BasicSocket#setsockopt' do it 'raises ArgumentError when passing 2 arguments' do option = Socket::Option.bool(:INET, :SOCKET, :REUSEADDR, true) - lambda { @socket.setsockopt(option, :REUSEADDR) }.should raise_error(ArgumentError) + -> { @socket.setsockopt(option, :REUSEADDR) }.should raise_error(ArgumentError) end it 'raises TypeError when passing 3 arguments' do option = Socket::Option.bool(:INET, :SOCKET, :REUSEADDR, true) - lambda { @socket.setsockopt(option, :REUSEADDR, true) }.should raise_error(TypeError) + -> { @socket.setsockopt(option, :REUSEADDR, true) }.should raise_error(TypeError) end end end diff --git a/spec/ruby/library/socket/basicsocket/shutdown_spec.rb b/spec/ruby/library/socket/basicsocket/shutdown_spec.rb index 87a32ae1dc..41d9581bde 100644 --- a/spec/ruby/library/socket/basicsocket/shutdown_spec.rb +++ b/spec/ruby/library/socket/basicsocket/shutdown_spec.rb @@ -29,7 +29,7 @@ platform_is_not :windows do # hangs it 'shuts down a socket for writing' do @client.shutdown(Socket::SHUT_WR) - lambda { @client.write('hello') }.should raise_error(Errno::EPIPE) + -> { @client.write('hello') }.should raise_error(Errno::EPIPE) end it 'shuts down a socket for reading and writing' do @@ -37,11 +37,11 @@ platform_is_not :windows do # hangs @client.recv(1).should be_empty - lambda { @client.write('hello') }.should raise_error(Errno::EPIPE) + -> { @client.write('hello') }.should raise_error(Errno::EPIPE) end it 'raises ArgumentError when using an invalid option' do - lambda { @server.shutdown(666) }.should raise_error(ArgumentError) + -> { @server.shutdown(666) }.should raise_error(ArgumentError) end end @@ -61,13 +61,13 @@ platform_is_not :windows do # hangs it 'shuts down a socket for writing using :WR' do @client.shutdown(:WR) - lambda { @client.write('hello') }.should raise_error(Errno::EPIPE) + -> { @client.write('hello') }.should raise_error(Errno::EPIPE) end it 'shuts down a socket for writing using :SHUT_WR' do @client.shutdown(:SHUT_WR) - lambda { @client.write('hello') }.should raise_error(Errno::EPIPE) + -> { @client.write('hello') }.should raise_error(Errno::EPIPE) end it 'shuts down a socket for reading and writing' do @@ -75,11 +75,11 @@ platform_is_not :windows do # hangs @client.recv(1).should be_empty - lambda { @client.write('hello') }.should raise_error(Errno::EPIPE) + -> { @client.write('hello') }.should raise_error(Errno::EPIPE) end it 'raises ArgumentError when using an invalid option' do - lambda { @server.shutdown(:Nope) }.should raise_error(SocketError) + -> { @server.shutdown(:Nope) }.should raise_error(SocketError) end end @@ -99,17 +99,17 @@ platform_is_not :windows do # hangs it 'shuts down a socket for writing using "WR"' do @client.shutdown('WR') - lambda { @client.write('hello') }.should raise_error(Errno::EPIPE) + -> { @client.write('hello') }.should raise_error(Errno::EPIPE) end it 'shuts down a socket for writing using "SHUT_WR"' do @client.shutdown('SHUT_WR') - lambda { @client.write('hello') }.should raise_error(Errno::EPIPE) + -> { @client.write('hello') }.should raise_error(Errno::EPIPE) end it 'raises ArgumentError when using an invalid option' do - lambda { @server.shutdown('Nope') }.should raise_error(SocketError) + -> { @server.shutdown('Nope') }.should raise_error(SocketError) end end @@ -141,13 +141,13 @@ platform_is_not :windows do # hangs @client.recv(1).should be_empty - lambda { @client.write('hello') }.should raise_error(Errno::EPIPE) + -> { @client.write('hello') }.should raise_error(Errno::EPIPE) end end describe 'using an object that does not respond to #to_str' do it 'raises TypeError' do - lambda { @server.shutdown(mock(:dummy)) }.should raise_error(TypeError) + -> { @server.shutdown(mock(:dummy)) }.should raise_error(TypeError) end end end diff --git a/spec/ruby/library/socket/ipsocket/addr_spec.rb b/spec/ruby/library/socket/ipsocket/addr_spec.rb index 07f4cb20c9..199eb85ab7 100644 --- a/spec/ruby/library/socket/ipsocket/addr_spec.rb +++ b/spec/ruby/library/socket/ipsocket/addr_spec.rb @@ -81,7 +81,7 @@ describe 'Socket::IPSocket#addr' do describe 'using :cats as the argument' do it 'raises ArgumentError' do - lambda { @server.addr(:cats) }.should raise_error(ArgumentError) + -> { @server.addr(:cats) }.should raise_error(ArgumentError) end end end diff --git a/spec/ruby/library/socket/ipsocket/getaddress_spec.rb b/spec/ruby/library/socket/ipsocket/getaddress_spec.rb index 8e14707d4f..746d2ab86b 100644 --- a/spec/ruby/library/socket/ipsocket/getaddress_spec.rb +++ b/spec/ruby/library/socket/ipsocket/getaddress_spec.rb @@ -18,7 +18,7 @@ describe "Socket::IPSocket#getaddress" do # DNS servers like opendns return A records for ANY host, including # traditionally invalidly named ones. it "raises an error on unknown hostnames" do - lambda { + -> { IPSocket.getaddress("rubyspecdoesntexist.fallingsnow.net") }.should raise_error(SocketError) end diff --git a/spec/ruby/library/socket/ipsocket/peeraddr_spec.rb b/spec/ruby/library/socket/ipsocket/peeraddr_spec.rb index 26aa61d1c4..702650940b 100644 --- a/spec/ruby/library/socket/ipsocket/peeraddr_spec.rb +++ b/spec/ruby/library/socket/ipsocket/peeraddr_spec.rb @@ -16,7 +16,7 @@ describe "Socket::IPSocket#peeraddr" do end it "raises error if socket is not connected" do - lambda { + -> { @server.peeraddr }.should raise_error(Errno::ENOTCONN) end @@ -92,7 +92,7 @@ describe 'Socket::IPSocket#peeraddr' do describe 'using :cats as the argument' do it 'raises ArgumentError' do - lambda { @client.peeraddr(:cats) }.should raise_error(ArgumentError) + -> { @client.peeraddr(:cats) }.should raise_error(ArgumentError) end end end diff --git a/spec/ruby/library/socket/option/bool_spec.rb b/spec/ruby/library/socket/option/bool_spec.rb index c4f8a277ba..144a78043d 100644 --- a/spec/ruby/library/socket/option/bool_spec.rb +++ b/spec/ruby/library/socket/option/bool_spec.rb @@ -21,7 +21,7 @@ describe "Socket::Option#bool" do platform_is_not :windows do it 'raises TypeError when called on a non boolean option' do opt = Socket::Option.linger(1, 4) - lambda { opt.bool }.should raise_error(TypeError) + -> { opt.bool }.should raise_error(TypeError) end end end diff --git a/spec/ruby/library/socket/option/initialize_spec.rb b/spec/ruby/library/socket/option/initialize_spec.rb index 0d4621b71e..8071ad7ef0 100644 --- a/spec/ruby/library/socket/option/initialize_spec.rb +++ b/spec/ruby/library/socket/option/initialize_spec.rb @@ -32,19 +32,19 @@ describe 'Socket::Option#initialize' do end it 'raises when using an invalid address family' do - lambda { + -> { Socket::Option.new(:INET2, :SOCKET, :KEEPALIVE, @bool) }.should raise_error(SocketError) end it 'raises when using an invalid level' do - lambda { + -> { Socket::Option.new(:INET, :CATS, :KEEPALIVE, @bool) }.should raise_error(SocketError) end it 'raises when using an invalid option name' do - lambda { + -> { Socket::Option.new(:INET, :SOCKET, :CATS, @bool) }.should raise_error(SocketError) end @@ -63,19 +63,19 @@ describe 'Socket::Option#initialize' do end it 'raises when using an invalid address family' do - lambda { + -> { Socket::Option.new('INET2', 'SOCKET', 'KEEPALIVE', @bool) }.should raise_error(SocketError) end it 'raises when using an invalid level' do - lambda { + -> { Socket::Option.new('INET', 'CATS', 'KEEPALIVE', @bool) }.should raise_error(SocketError) end it 'raises when using an invalid option name' do - lambda { + -> { Socket::Option.new('INET', 'SOCKET', 'CATS', @bool) }.should raise_error(SocketError) end diff --git a/spec/ruby/library/socket/option/int_spec.rb b/spec/ruby/library/socket/option/int_spec.rb index 5c67ec26d8..8c69ef6cbd 100644 --- a/spec/ruby/library/socket/option/int_spec.rb +++ b/spec/ruby/library/socket/option/int_spec.rb @@ -37,7 +37,7 @@ describe "Socket::Option#int" do platform_is_not :windows do it 'raises TypeError when called on a non integer option' do opt = Socket::Option.linger(1, 4) - lambda { opt.int }.should raise_error(TypeError) + -> { opt.int }.should raise_error(TypeError) end end end diff --git a/spec/ruby/library/socket/option/linger_spec.rb b/spec/ruby/library/socket/option/linger_spec.rb index 94467ebf71..ee987db85b 100644 --- a/spec/ruby/library/socket/option/linger_spec.rb +++ b/spec/ruby/library/socket/option/linger_spec.rb @@ -52,25 +52,25 @@ describe "Socket::Option#linger" do it "raises TypeError if not a SO_LINGER" do so = Socket::Option.int(:AF_UNSPEC, :SOL_SOCKET, :KEEPALIVE, 1) - lambda { so.linger }.should raise_error(TypeError) + -> { so.linger }.should raise_error(TypeError) end it 'raises TypeError when called on a non SOL_SOCKET/SO_LINGER option' do opt = Socket::Option.int(:INET, :IP, :TTL, 4) - lambda { opt.linger }.should raise_error(TypeError) + -> { opt.linger }.should raise_error(TypeError) end platform_is_not :windows do it "raises TypeError if option has not good size" do so = Socket::Option.int(:AF_UNSPEC, :SOL_SOCKET, :LINGER, 1) - lambda { so.linger }.should raise_error(TypeError) + -> { so.linger }.should raise_error(TypeError) end end it 'raises TypeError when called on a non linger option' do opt = Socket::Option.new(:INET, :SOCKET, :LINGER, '') - lambda { opt.linger }.should raise_error(TypeError) + -> { opt.linger }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/socket/option/new_spec.rb b/spec/ruby/library/socket/option/new_spec.rb index f3b7b31c91..a9e6f09097 100644 --- a/spec/ruby/library/socket/option/new_spec.rb +++ b/spec/ruby/library/socket/option/new_spec.rb @@ -22,14 +22,14 @@ describe "Socket::Option.new" do end it "should raise error on unknown family" do - lambda { Socket::Option.new(:INET4, :SOCKET, :KEEPALIVE, [0].pack('i')) }.should raise_error(SocketError) + -> { Socket::Option.new(:INET4, :SOCKET, :KEEPALIVE, [0].pack('i')) }.should raise_error(SocketError) end it "should raise error on unknown level" do - lambda { Socket::Option.new(:INET, :ROCKET, :KEEPALIVE, [0].pack('i')) }.should raise_error(SocketError) + -> { Socket::Option.new(:INET, :ROCKET, :KEEPALIVE, [0].pack('i')) }.should raise_error(SocketError) end it "should raise error on unknown option name" do - lambda { Socket::Option.new(:INET, :SOCKET, :ALIVE, [0].pack('i')) }.should raise_error(SocketError) + -> { Socket::Option.new(:INET, :SOCKET, :ALIVE, [0].pack('i')) }.should raise_error(SocketError) end end diff --git a/spec/ruby/library/socket/shared/pack_sockaddr.rb b/spec/ruby/library/socket/shared/pack_sockaddr.rb index 40b0d8d59e..2df09027c9 100644 --- a/spec/ruby/library/socket/shared/pack_sockaddr.rb +++ b/spec/ruby/library/socket/shared/pack_sockaddr.rb @@ -93,7 +93,7 @@ describe :socket_pack_sockaddr_un, shared: true do it "raises ArgumentError for paths that are too long" do # AIX doesn't raise error long_path = 'a' * 110 - lambda { Socket.public_send(@method, long_path) }.should raise_error(ArgumentError) + -> { Socket.public_send(@method, long_path) }.should raise_error(ArgumentError) end end end diff --git a/spec/ruby/library/socket/shared/socketpair.rb b/spec/ruby/library/socket/shared/socketpair.rb index 08db2e59b8..25146cfff6 100644 --- a/spec/ruby/library/socket/shared/socketpair.rb +++ b/spec/ruby/library/socket/shared/socketpair.rb @@ -42,11 +42,11 @@ describe :socket_socketpair, shared: true do end it 'raises SocketError for an unknown address family' do - lambda { Socket.public_send(@method, :CATS, :STREAM) }.should raise_error(SocketError) + -> { Socket.public_send(@method, :CATS, :STREAM) }.should raise_error(SocketError) end it 'raises SocketError for an unknown socket type' do - lambda { Socket.public_send(@method, :UNIX, :CATS) }.should raise_error(SocketError) + -> { Socket.public_send(@method, :UNIX, :CATS) }.should raise_error(SocketError) end end @@ -61,11 +61,11 @@ describe :socket_socketpair, shared: true do end it 'raises SocketError for an unknown address family' do - lambda { Socket.public_send(@method, 'CATS', 'STREAM') }.should raise_error(SocketError) + -> { Socket.public_send(@method, 'CATS', 'STREAM') }.should raise_error(SocketError) end it 'raises SocketError for an unknown socket type' do - lambda { Socket.public_send(@method, 'UNIX', 'CATS') }.should raise_error(SocketError) + -> { Socket.public_send(@method, 'UNIX', 'CATS') }.should raise_error(SocketError) end end @@ -92,7 +92,7 @@ describe :socket_socketpair, shared: true do family.stub!(:to_str).and_return(Socket::AF_UNIX) type.stub!(:to_str).and_return(Socket::SOCK_STREAM) - lambda { Socket.public_send(@method, family, type) }.should raise_error(TypeError) + -> { Socket.public_send(@method, family, type) }.should raise_error(TypeError) end it 'raises SocketError for an unknown address family' do @@ -102,7 +102,7 @@ describe :socket_socketpair, shared: true do family.stub!(:to_str).and_return('CATS') type.stub!(:to_str).and_return('STREAM') - lambda { Socket.public_send(@method, family, type) }.should raise_error(SocketError) + -> { Socket.public_send(@method, family, type) }.should raise_error(SocketError) end it 'raises SocketError for an unknown socket type' do @@ -112,7 +112,7 @@ describe :socket_socketpair, shared: true do family.stub!(:to_str).and_return('UNIX') type.stub!(:to_str).and_return('CATS') - lambda { Socket.public_send(@method, family, type) }.should raise_error(SocketError) + -> { Socket.public_send(@method, family, type) }.should raise_error(SocketError) end end diff --git a/spec/ruby/library/socket/socket/accept_loop_spec.rb b/spec/ruby/library/socket/socket/accept_loop_spec.rb index ee11569da3..78e8c3fa4a 100644 --- a/spec/ruby/library/socket/socket/accept_loop_spec.rb +++ b/spec/ruby/library/socket/socket/accept_loop_spec.rb @@ -20,7 +20,7 @@ describe 'Socket.accept_loop' do # https://ci.appveyor.com/project/ruby/ruby/builds/20817932/job/dor2ipny7ru4erpa platform_is_not :windows do it 'blocks the caller' do - lambda { Socket.accept_loop([@server]) }.should block_caller + -> { Socket.accept_loop([@server]) }.should block_caller end end end @@ -53,7 +53,7 @@ describe 'Socket.accept_loop' do describe 'using separate Socket arguments' do describe 'without any available connections' do it 'blocks the caller' do - lambda { Socket.accept_loop(@server) }.should block_caller + -> { Socket.accept_loop(@server) }.should block_caller end end diff --git a/spec/ruby/library/socket/socket/accept_nonblock_spec.rb b/spec/ruby/library/socket/socket/accept_nonblock_spec.rb index cde9e6a4b6..3221f0b128 100644 --- a/spec/ruby/library/socket/socket/accept_nonblock_spec.rb +++ b/spec/ruby/library/socket/socket/accept_nonblock_spec.rb @@ -15,7 +15,7 @@ describe "Socket#accept_nonblock" do end it "raises IO::WaitReadable if the connection is not accepted yet" do - lambda { + -> { @socket.accept_nonblock }.should raise_error(IO::WaitReadable) { |e| platform_is_not :windows do @@ -45,7 +45,7 @@ describe 'Socket#accept_nonblock' do describe 'using an unbound socket' do it 'raises Errno::EINVAL' do - lambda { @server.accept_nonblock }.should raise_error(Errno::EINVAL) + -> { @server.accept_nonblock }.should raise_error(Errno::EINVAL) end end @@ -55,7 +55,7 @@ describe 'Socket#accept_nonblock' do end it 'raises Errno::EINVAL' do - lambda { @server.accept_nonblock }.should raise_error(Errno::EINVAL) + -> { @server.accept_nonblock }.should raise_error(Errno::EINVAL) end end @@ -63,7 +63,7 @@ describe 'Socket#accept_nonblock' do it 'raises IOError' do @server.close - lambda { @server.accept_nonblock }.should raise_error(IOError) + -> { @server.accept_nonblock }.should raise_error(IOError) end end @@ -75,7 +75,7 @@ describe 'Socket#accept_nonblock' do describe 'without a connected client' do it 'raises IO::WaitReadable' do - lambda { @server.accept_nonblock }.should raise_error(IO::WaitReadable) + -> { @server.accept_nonblock }.should raise_error(IO::WaitReadable) end end diff --git a/spec/ruby/library/socket/socket/accept_spec.rb b/spec/ruby/library/socket/socket/accept_spec.rb index a0778caa23..417f996c55 100644 --- a/spec/ruby/library/socket/socket/accept_spec.rb +++ b/spec/ruby/library/socket/socket/accept_spec.rb @@ -15,7 +15,7 @@ describe 'Socket#accept' do platform_is :linux do # hangs on other platforms describe 'using an unbound socket' do it 'raises Errno::EINVAL' do - lambda { @server.accept }.should raise_error(Errno::EINVAL) + -> { @server.accept }.should raise_error(Errno::EINVAL) end end @@ -25,7 +25,7 @@ describe 'Socket#accept' do end it 'raises Errno::EINVAL' do - lambda { @server.accept }.should raise_error(Errno::EINVAL) + -> { @server.accept }.should raise_error(Errno::EINVAL) end end end @@ -34,7 +34,7 @@ describe 'Socket#accept' do it 'raises IOError' do @server.close - lambda { @server.accept }.should raise_error(IOError) + -> { @server.accept }.should raise_error(IOError) end end @@ -56,7 +56,6 @@ describe 'Socket#accept' do client.connect(@server_addr) - thread.join(5) value = thread.value begin value.should be_an_instance_of(Array) diff --git a/spec/ruby/library/socket/socket/bind_spec.rb b/spec/ruby/library/socket/socket/bind_spec.rb index 3a7df6ed71..0349df84a6 100644 --- a/spec/ruby/library/socket/socket/bind_spec.rb +++ b/spec/ruby/library/socket/socket/bind_spec.rb @@ -13,7 +13,7 @@ describe "Socket#bind on SOCK_DGRAM socket" do end it "binds to a port" do - lambda { @sock.bind(@sockaddr) }.should_not raise_error + -> { @sock.bind(@sockaddr) }.should_not raise_error end it "returns 0 if successful" do @@ -23,19 +23,19 @@ describe "Socket#bind on SOCK_DGRAM socket" do it "raises Errno::EINVAL when already bound" do @sock.bind(@sockaddr) - lambda { @sock.bind(@sockaddr) }.should raise_error(Errno::EINVAL) + -> { @sock.bind(@sockaddr) }.should raise_error(Errno::EINVAL) end it "raises Errno::EADDRNOTAVAIL when the specified sockaddr is not available from the local machine" do sockaddr1 = Socket.pack_sockaddr_in(0, "4.3.2.1") - lambda { @sock.bind(sockaddr1) }.should raise_error(Errno::EADDRNOTAVAIL) + -> { @sock.bind(sockaddr1) }.should raise_error(Errno::EADDRNOTAVAIL) end platform_is_not :windows, :cygwin do as_user do it "raises Errno::EACCES when the current user does not have permission to bind" do sockaddr1 = Socket.pack_sockaddr_in(1, "127.0.0.1") - lambda { @sock.bind(sockaddr1) }.should raise_error(Errno::EACCES) + -> { @sock.bind(sockaddr1) }.should raise_error(Errno::EACCES) end end end @@ -54,7 +54,7 @@ describe "Socket#bind on SOCK_STREAM socket" do end it "binds to a port" do - lambda { @sock.bind(@sockaddr) }.should_not raise_error + -> { @sock.bind(@sockaddr) }.should_not raise_error end it "returns 0 if successful" do @@ -64,19 +64,19 @@ describe "Socket#bind on SOCK_STREAM socket" do it "raises Errno::EINVAL when already bound" do @sock.bind(@sockaddr) - lambda { @sock.bind(@sockaddr) }.should raise_error(Errno::EINVAL) + -> { @sock.bind(@sockaddr) }.should raise_error(Errno::EINVAL) end it "raises Errno::EADDRNOTAVAIL when the specified sockaddr is not available from the local machine" do sockaddr1 = Socket.pack_sockaddr_in(0, "4.3.2.1") - lambda { @sock.bind(sockaddr1) }.should raise_error(Errno::EADDRNOTAVAIL) + -> { @sock.bind(sockaddr1) }.should raise_error(Errno::EADDRNOTAVAIL) end platform_is_not :windows, :cygwin do as_user do it "raises Errno::EACCES when the current user does not have permission to bind" do sockaddr1 = Socket.pack_sockaddr_in(1, "127.0.0.1") - lambda { @sock.bind(sockaddr1) }.should raise_error(Errno::EACCES) + -> { @sock.bind(sockaddr1) }.should raise_error(Errno::EACCES) end end end @@ -101,14 +101,14 @@ describe 'Socket#bind' do it 'raises Errno::EINVAL when binding to an already bound port' do @socket.bind(@sockaddr) - lambda { @socket.bind(@sockaddr) }.should raise_error(Errno::EINVAL) + -> { @socket.bind(@sockaddr) }.should raise_error(Errno::EINVAL) end it 'raises Errno::EADDRNOTAVAIL when the specified sockaddr is not available' do ip = family == Socket::AF_INET ? '4.3.2.1' : '::2' sockaddr1 = Socket.sockaddr_in(0, ip) - lambda { @socket.bind(sockaddr1) }.should raise_error(Errno::EADDRNOTAVAIL) + -> { @socket.bind(sockaddr1) }.should raise_error(Errno::EADDRNOTAVAIL) end platform_is_not :windows do @@ -116,7 +116,7 @@ describe 'Socket#bind' do it 'raises Errno::EACCES when the user is not allowed to bind to the port' do sockaddr1 = Socket.pack_sockaddr_in(1, ip_address) - lambda { @socket.bind(sockaddr1) }.should raise_error(Errno::EACCES) + -> { @socket.bind(sockaddr1) }.should raise_error(Errno::EACCES) end end end diff --git a/spec/ruby/library/socket/socket/connect_nonblock_spec.rb b/spec/ruby/library/socket/socket/connect_nonblock_spec.rb index b5f416d96f..3cf667fc4a 100644 --- a/spec/ruby/library/socket/socket/connect_nonblock_spec.rb +++ b/spec/ruby/library/socket/socket/connect_nonblock_spec.rb @@ -53,13 +53,13 @@ describe "Socket#connect_nonblock" do platform_is_not :freebsd, :solaris, :aix do it "raises Errno::EINPROGRESS when the connect would block" do - lambda do + -> do @socket.connect_nonblock(@addr) end.should raise_error(Errno::EINPROGRESS) end it "raises Errno::EINPROGRESS with IO::WaitWritable mixed in when the connect would block" do - lambda do + -> do @socket.connect_nonblock(@addr) end.should raise_error(IO::WaitWritable) end @@ -95,7 +95,7 @@ describe 'Socket#connect_nonblock' do end it 'raises TypeError when passed an Integer' do - lambda { @client.connect_nonblock(666) }.should raise_error(TypeError) + -> { @client.connect_nonblock(666) }.should raise_error(TypeError) end end @@ -116,7 +116,7 @@ describe 'Socket#connect_nonblock' do @server.listen(1) @client.connect(@server.connect_address).should == 0 - lambda { + -> { @client.connect_nonblock(@server.connect_address) # A second call needed if non-blocking sockets become default @@ -139,7 +139,7 @@ describe 'Socket#connect_nonblock' do it 'raises IO:EINPROGRESSWaitWritable when the connection would block' do @server.bind(@sockaddr) - lambda { + -> { @client.connect_nonblock(@server.connect_address) }.should raise_error(IO::EINPROGRESSWaitWritable) end diff --git a/spec/ruby/library/socket/socket/connect_spec.rb b/spec/ruby/library/socket/socket/connect_spec.rb index df5cc5bf34..8653fba552 100644 --- a/spec/ruby/library/socket/socket/connect_spec.rb +++ b/spec/ruby/library/socket/socket/connect_spec.rb @@ -32,7 +32,7 @@ describe 'Socket#connect' do @client.connect(@server.getsockname).should == 0 - lambda { + -> { @client.connect(@server.getsockname) # A second call needed if non-blocking sockets become default diff --git a/spec/ruby/library/socket/socket/gethostbyaddr_spec.rb b/spec/ruby/library/socket/socket/gethostbyaddr_spec.rb index 639a318132..5d97341103 100644 --- a/spec/ruby/library/socket/socket/gethostbyaddr_spec.rb +++ b/spec/ruby/library/socket/socket/gethostbyaddr_spec.rb @@ -57,7 +57,7 @@ describe 'Socket.gethostbyaddr' do end it 'raises SocketError when the address is not supported by the family' do - lambda { Socket.gethostbyaddr(@addr, :INET6) }.should raise_error(SocketError) + -> { Socket.gethostbyaddr(@addr, :INET6) }.should raise_error(SocketError) end end end @@ -115,7 +115,7 @@ describe 'Socket.gethostbyaddr' do platform_is_not :windows do it 'raises SocketError when the address is not supported by the family' do - lambda { Socket.gethostbyaddr(@addr, :INET) }.should raise_error(SocketError) + -> { Socket.gethostbyaddr(@addr, :INET) }.should raise_error(SocketError) end end end diff --git a/spec/ruby/library/socket/socket/getnameinfo_spec.rb b/spec/ruby/library/socket/socket/getnameinfo_spec.rb index fbbbcb53c5..b406348aa8 100644 --- a/spec/ruby/library/socket/socket/getnameinfo_spec.rb +++ b/spec/ruby/library/socket/socket/getnameinfo_spec.rb @@ -69,7 +69,7 @@ describe 'Socket.getnameinfo' do end it 'raises SocketError or TypeError when using an invalid String' do - lambda { Socket.getnameinfo('cats') }.should raise_error(Exception) { |e| + -> { Socket.getnameinfo('cats') }.should raise_error(Exception) { |e| [SocketError, TypeError].should include(e.class) } end @@ -102,7 +102,7 @@ describe 'Socket.getnameinfo' do end it 'raises ArgumentError when using an invalid Array' do - lambda { Socket.getnameinfo([family_name]) }.should raise_error(ArgumentError) + -> { Socket.getnameinfo([family_name]) }.should raise_error(ArgumentError) end platform_is_not :windows do diff --git a/spec/ruby/library/socket/socket/getservbyname_spec.rb b/spec/ruby/library/socket/socket/getservbyname_spec.rb index 9479b26228..d361e619f2 100644 --- a/spec/ruby/library/socket/socket/getservbyname_spec.rb +++ b/spec/ruby/library/socket/socket/getservbyname_spec.rb @@ -27,6 +27,6 @@ describe "Socket#getservbyname" do end it "raises a SocketError when the service or port is invalid" do - lambda { Socket.getservbyname('invalid') }.should raise_error(SocketError) + -> { Socket.getservbyname('invalid') }.should raise_error(SocketError) end end diff --git a/spec/ruby/library/socket/socket/getservbyport_spec.rb b/spec/ruby/library/socket/socket/getservbyport_spec.rb index 9be2ac527e..563c592b54 100644 --- a/spec/ruby/library/socket/socket/getservbyport_spec.rb +++ b/spec/ruby/library/socket/socket/getservbyport_spec.rb @@ -18,6 +18,6 @@ describe 'Socket.getservbyport' do end it 'raises SocketError for an unknown port number' do - lambda { Socket.getservbyport(0) }.should raise_error(SocketError) + -> { Socket.getservbyport(0) }.should raise_error(SocketError) end end diff --git a/spec/ruby/library/socket/socket/initialize_spec.rb b/spec/ruby/library/socket/socket/initialize_spec.rb index 2343c6e289..f8337bcaa5 100644 --- a/spec/ruby/library/socket/socket/initialize_spec.rb +++ b/spec/ruby/library/socket/socket/initialize_spec.rb @@ -53,7 +53,7 @@ describe 'Socket#initialize' do family.stub!(:to_str).and_return(Socket::AF_INET) type.stub!(:to_str).and_return(Socket::SOCK_STREAM) - lambda { Socket.new(family, type) }.should raise_error(TypeError) + -> { Socket.new(family, type) }.should raise_error(TypeError) end end @@ -65,7 +65,7 @@ describe 'Socket#initialize' do end it 'raises TypeError when using a Symbol' do - lambda { Socket.new(:INET, :STREAM, :TCP) }.should raise_error(TypeError) + -> { Socket.new(:INET, :STREAM, :TCP) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/socket/socket/listen_spec.rb b/spec/ruby/library/socket/socket/listen_spec.rb index d0f9c70c4e..5de70d6db0 100644 --- a/spec/ruby/library/socket/socket/listen_spec.rb +++ b/spec/ruby/library/socket/socket/listen_spec.rb @@ -35,7 +35,7 @@ describe 'Socket#listen' do end it 'raises Errno::EOPNOTSUPP' do - lambda { @server.listen(1) }.should raise_error(Errno::EOPNOTSUPP) + -> { @server.listen(1) }.should raise_error(Errno::EOPNOTSUPP) end end @@ -57,7 +57,7 @@ describe 'Socket#listen' do end it "raises when the given argument can't be coerced to an Integer" do - lambda { @server.listen('cats') }.should raise_error(TypeError) + -> { @server.listen('cats') }.should raise_error(TypeError) end end end diff --git a/spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb b/spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb index 5f717d4b54..94f58ac49f 100644 --- a/spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb +++ b/spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb @@ -16,7 +16,7 @@ describe 'Socket#recvfrom_nonblock' do platform_is_not :windows do describe 'using an unbound socket' do it 'raises IO::WaitReadable' do - lambda { @server.recvfrom_nonblock(1) }.should raise_error(IO::WaitReadable) + -> { @server.recvfrom_nonblock(1) }.should raise_error(IO::WaitReadable) end end end @@ -29,7 +29,7 @@ describe 'Socket#recvfrom_nonblock' do describe 'without any data available' do it 'raises IO::WaitReadable' do - lambda { @server.recvfrom_nonblock(1) }.should raise_error(IO::WaitReadable) + -> { @server.recvfrom_nonblock(1) }.should raise_error(IO::WaitReadable) end it 'returns :wait_readable with exception: false' do diff --git a/spec/ruby/library/socket/socket/recvfrom_spec.rb b/spec/ruby/library/socket/socket/recvfrom_spec.rb index 7f0714511c..faf161e4a5 100644 --- a/spec/ruby/library/socket/socket/recvfrom_spec.rb +++ b/spec/ruby/library/socket/socket/recvfrom_spec.rb @@ -15,7 +15,7 @@ describe 'Socket#recvfrom' do describe 'using an unbound socket' do it 'blocks the caller' do - lambda { @server.recvfrom(1) }.should block_caller + -> { @server.recvfrom(1) }.should block_caller end end @@ -27,7 +27,7 @@ describe 'Socket#recvfrom' do describe 'without any data available' do it 'blocks the caller' do - lambda { @server.recvfrom(1) }.should block_caller + -> { @server.recvfrom(1) }.should block_caller end end diff --git a/spec/ruby/library/socket/socket/sysaccept_spec.rb b/spec/ruby/library/socket/socket/sysaccept_spec.rb index f039096707..92ac21124e 100644 --- a/spec/ruby/library/socket/socket/sysaccept_spec.rb +++ b/spec/ruby/library/socket/socket/sysaccept_spec.rb @@ -15,7 +15,7 @@ describe 'Socket#sysaccept' do platform_is :linux do # hangs on other platforms describe 'using an unbound socket' do it 'raises Errno::EINVAL' do - lambda { @server.sysaccept }.should raise_error(Errno::EINVAL) + -> { @server.sysaccept }.should raise_error(Errno::EINVAL) end end @@ -25,7 +25,7 @@ describe 'Socket#sysaccept' do end it 'raises Errno::EINVAL' do - lambda { @server.sysaccept }.should raise_error(Errno::EINVAL) + -> { @server.sysaccept }.should raise_error(Errno::EINVAL) end end end @@ -59,8 +59,6 @@ describe 'Socket#sysaccept' do @client.connect(@server_addr) - thread.join(5) - thread.value.should be_an_instance_of(Array) end end diff --git a/spec/ruby/library/socket/socket/tcp_server_loop_spec.rb b/spec/ruby/library/socket/socket/tcp_server_loop_spec.rb index 05ecad67d1..a46c6df5c6 100644 --- a/spec/ruby/library/socket/socket/tcp_server_loop_spec.rb +++ b/spec/ruby/library/socket/socket/tcp_server_loop_spec.rb @@ -4,7 +4,7 @@ require_relative '../fixtures/classes' describe 'Socket.tcp_server_loop' do describe 'when no connections are available' do it 'blocks the caller' do - lambda { Socket.tcp_server_loop('127.0.0.1', 0) }.should block_caller + -> { Socket.tcp_server_loop('127.0.0.1', 0) }.should block_caller end end @@ -45,7 +45,7 @@ describe 'Socket.tcp_server_loop' do # At this point the connection has been set up but the thread may not yet # have returned, thus we'll need to wait a little longer for it to # complete. - thread.join(2) + thread.join @sock.should be_an_instance_of(Socket) addr.should be_an_instance_of(Addrinfo) diff --git a/spec/ruby/library/socket/socket/tcp_spec.rb b/spec/ruby/library/socket/socket/tcp_spec.rb index 29f166ffc5..d36e3e6adb 100644 --- a/spec/ruby/library/socket/socket/tcp_spec.rb +++ b/spec/ruby/library/socket/socket/tcp_spec.rb @@ -49,7 +49,7 @@ describe 'Socket.tcp' do end it 'raises ArgumentError when 6 arguments are provided' do - lambda { + -> { Socket.tcp(@host, @port, @host, 0, {:connect_timeout => 1}, 10) }.should raise_error(ArgumentError) end diff --git a/spec/ruby/library/socket/socket/udp_server_loop_on_spec.rb b/spec/ruby/library/socket/socket/udp_server_loop_on_spec.rb index 1cb82d72be..cb8c5c5587 100644 --- a/spec/ruby/library/socket/socket/udp_server_loop_on_spec.rb +++ b/spec/ruby/library/socket/socket/udp_server_loop_on_spec.rb @@ -13,7 +13,7 @@ describe 'Socket.udp_server_loop_on' do describe 'when no connections are available' do it 'blocks the caller' do - lambda { Socket.udp_server_loop_on([@server]) }.should block_caller + -> { Socket.udp_server_loop_on([@server]) }.should block_caller end end diff --git a/spec/ruby/library/socket/socket/udp_server_loop_spec.rb b/spec/ruby/library/socket/socket/udp_server_loop_spec.rb index 168c17545f..66563bc742 100644 --- a/spec/ruby/library/socket/socket/udp_server_loop_spec.rb +++ b/spec/ruby/library/socket/socket/udp_server_loop_spec.rb @@ -4,7 +4,7 @@ require_relative '../fixtures/classes' describe 'Socket.udp_server_loop' do describe 'when no connections are available' do it 'blocks the caller' do - lambda { Socket.udp_server_loop('127.0.0.1', 0) }.should block_caller + -> { Socket.udp_server_loop('127.0.0.1', 0) }.should block_caller end end diff --git a/spec/ruby/library/socket/socket/unix_server_loop_spec.rb b/spec/ruby/library/socket/socket/unix_server_loop_spec.rb index a2d2ad9fdb..0f34d4a50b 100644 --- a/spec/ruby/library/socket/socket/unix_server_loop_spec.rb +++ b/spec/ruby/library/socket/socket/unix_server_loop_spec.rb @@ -13,7 +13,7 @@ with_feature :unix_socket do describe 'when no connections are available' do it 'blocks the caller' do - lambda { Socket.unix_server_loop(@path) }.should block_caller + -> { Socket.unix_server_loop(@path) }.should block_caller end end @@ -48,7 +48,7 @@ with_feature :unix_socket do end end - thread.join(2) + thread.join @sock.should be_an_instance_of(Socket) addr.should be_an_instance_of(Addrinfo) diff --git a/spec/ruby/library/socket/socket/unpack_sockaddr_in_spec.rb b/spec/ruby/library/socket/socket/unpack_sockaddr_in_spec.rb index 579ae307df..79ec68cd18 100644 --- a/spec/ruby/library/socket/socket/unpack_sockaddr_in_spec.rb +++ b/spec/ruby/library/socket/socket/unpack_sockaddr_in_spec.rb @@ -35,12 +35,12 @@ describe "Socket.unpack_sockaddr_in" do with_feature :unix_socket do it "raises an ArgumentError when the sin_family is not AF_INET" do sockaddr = Socket.sockaddr_un '/tmp/x' - lambda { Socket.unpack_sockaddr_in sockaddr }.should raise_error(ArgumentError) + -> { Socket.unpack_sockaddr_in sockaddr }.should raise_error(ArgumentError) end it "raises an ArgumentError when passed addrinfo is not AF_INET/AF_INET6" do addrinfo = Addrinfo.unix('/tmp/sock') - lambda { Socket.unpack_sockaddr_in(addrinfo) }.should raise_error(ArgumentError) + -> { Socket.unpack_sockaddr_in(addrinfo) }.should raise_error(ArgumentError) end end end diff --git a/spec/ruby/library/socket/socket/unpack_sockaddr_un_spec.rb b/spec/ruby/library/socket/socket/unpack_sockaddr_un_spec.rb index 39e33c90e9..bd95f1db08 100644 --- a/spec/ruby/library/socket/socket/unpack_sockaddr_un_spec.rb +++ b/spec/ruby/library/socket/socket/unpack_sockaddr_un_spec.rb @@ -15,12 +15,12 @@ with_feature :unix_socket do it 'raises an ArgumentError when the sin_family is not AF_UNIX' do sockaddr = Socket.sockaddr_in(0, '127.0.0.1') - lambda { Socket.unpack_sockaddr_un(sockaddr) }.should raise_error(ArgumentError) + -> { Socket.unpack_sockaddr_un(sockaddr) }.should raise_error(ArgumentError) end it 'raises an ArgumentError when passed addrinfo is not AF_UNIX' do addrinfo = Addrinfo.tcp('127.0.0.1', 0) - lambda { Socket.unpack_sockaddr_un(addrinfo) }.should raise_error(ArgumentError) + -> { Socket.unpack_sockaddr_un(addrinfo) }.should raise_error(ArgumentError) end end end diff --git a/spec/ruby/library/socket/tcpserver/accept_nonblock_spec.rb b/spec/ruby/library/socket/tcpserver/accept_nonblock_spec.rb index 6f118026ae..91f6a327f0 100644 --- a/spec/ruby/library/socket/tcpserver/accept_nonblock_spec.rb +++ b/spec/ruby/library/socket/tcpserver/accept_nonblock_spec.rb @@ -13,7 +13,7 @@ describe "Socket::TCPServer.accept_nonblock" do it "accepts non blocking connections" do @server.listen(5) - lambda { + -> { @server.accept_nonblock }.should raise_error(IO::WaitReadable) @@ -33,12 +33,12 @@ describe "Socket::TCPServer.accept_nonblock" do it "raises an IOError if the socket is closed" do @server.close - lambda { @server.accept }.should raise_error(IOError) + -> { @server.accept }.should raise_error(IOError) end describe 'without a connected client' do it 'raises error' do - lambda { @server.accept_nonblock }.should raise_error(IO::WaitReadable) + -> { @server.accept_nonblock }.should raise_error(IO::WaitReadable) end it 'returns :wait_readable in exceptionless mode' do @@ -59,7 +59,7 @@ describe 'TCPServer#accept_nonblock' do describe 'without a connected client' do it 'raises IO::WaitReadable' do - lambda { @server.accept_nonblock }.should raise_error(IO::WaitReadable) + -> { @server.accept_nonblock }.should raise_error(IO::WaitReadable) end end diff --git a/spec/ruby/library/socket/tcpserver/accept_spec.rb b/spec/ruby/library/socket/tcpserver/accept_spec.rb index f0ef9cc727..0da4e2218b 100644 --- a/spec/ruby/library/socket/tcpserver/accept_spec.rb +++ b/spec/ruby/library/socket/tcpserver/accept_spec.rb @@ -60,7 +60,7 @@ describe "TCPServer#accept" do it "raises an IOError if the socket is closed" do @server.close - lambda { @server.accept }.should raise_error(IOError) + -> { @server.accept }.should raise_error(IOError) end end @@ -76,7 +76,7 @@ describe 'TCPServer#accept' do describe 'without a connected client' do it 'blocks the caller' do - lambda { @server.accept }.should block_caller + -> { @server.accept }.should block_caller end end diff --git a/spec/ruby/library/socket/tcpserver/gets_spec.rb b/spec/ruby/library/socket/tcpserver/gets_spec.rb index 936295dce2..417976d737 100644 --- a/spec/ruby/library/socket/tcpserver/gets_spec.rb +++ b/spec/ruby/library/socket/tcpserver/gets_spec.rb @@ -11,6 +11,6 @@ describe "TCPServer#gets" do end it "raises Errno::ENOTCONN on gets" do - lambda { @server.gets }.should raise_error(Errno::ENOTCONN) + -> { @server.gets }.should raise_error(Errno::ENOTCONN) end end diff --git a/spec/ruby/library/socket/tcpserver/initialize_spec.rb b/spec/ruby/library/socket/tcpserver/initialize_spec.rb index 412bdbfb9d..4ddd1f465f 100644 --- a/spec/ruby/library/socket/tcpserver/initialize_spec.rb +++ b/spec/ruby/library/socket/tcpserver/initialize_spec.rb @@ -52,7 +52,7 @@ describe 'TCPServer#initialize' do describe 'with a single String argument containing a non numeric value' do it 'raises SocketError' do - lambda { TCPServer.new('cats') }.should raise_error(SocketError) + -> { TCPServer.new('cats') }.should raise_error(SocketError) end end diff --git a/spec/ruby/library/socket/tcpserver/listen_spec.rb b/spec/ruby/library/socket/tcpserver/listen_spec.rb index e266decd61..c877fdced6 100644 --- a/spec/ruby/library/socket/tcpserver/listen_spec.rb +++ b/spec/ruby/library/socket/tcpserver/listen_spec.rb @@ -16,7 +16,7 @@ describe 'TCPServer#listen' do end it "raises when the given argument can't be coerced to an Integer" do - lambda { @server.listen('cats') }.should raise_error(TypeError) + -> { @server.listen('cats') }.should raise_error(TypeError) end end end diff --git a/spec/ruby/library/socket/tcpserver/new_spec.rb b/spec/ruby/library/socket/tcpserver/new_spec.rb index 4717b95a2c..94e5744995 100644 --- a/spec/ruby/library/socket/tcpserver/new_spec.rb +++ b/spec/ruby/library/socket/tcpserver/new_spec.rb @@ -49,7 +49,7 @@ describe "TCPServer.new" do end it "coerces port to string, then determines port from that number or service name" do - lambda { TCPServer.new(SocketSpecs.hostname, Object.new) }.should raise_error(TypeError) + -> { TCPServer.new(SocketSpecs.hostname, Object.new) }.should raise_error(TypeError) port = Object.new port.should_receive(:to_str).and_return("0") @@ -63,7 +63,7 @@ describe "TCPServer.new" do end it "raises Errno::EADDRNOTAVAIL when the address is unknown" do - lambda { TCPServer.new("1.2.3.4", 0) }.should raise_error(Errno::EADDRNOTAVAIL) + -> { TCPServer.new("1.2.3.4", 0) }.should raise_error(Errno::EADDRNOTAVAIL) end # There is no way to make this fail-proof on all machines, because @@ -71,7 +71,7 @@ describe "TCPServer.new" do # traditionally invalidly named ones. quarantine! do it "raises a SocketError when the host is unknown" do - lambda { + -> { TCPServer.new("--notavalidname", 0) }.should raise_error(SocketError) end @@ -79,7 +79,7 @@ describe "TCPServer.new" do it "raises Errno::EADDRINUSE when address is already in use" do @server = TCPServer.new('127.0.0.1', 0) - lambda { + -> { @server = TCPServer.new('127.0.0.1', @server.addr[1]) }.should raise_error(Errno::EADDRINUSE) end diff --git a/spec/ruby/library/socket/tcpserver/sysaccept_spec.rb b/spec/ruby/library/socket/tcpserver/sysaccept_spec.rb index 5543b67755..bd7d33faf4 100644 --- a/spec/ruby/library/socket/tcpserver/sysaccept_spec.rb +++ b/spec/ruby/library/socket/tcpserver/sysaccept_spec.rb @@ -12,7 +12,7 @@ describe "TCPServer#sysaccept" do end it 'blocks if no connections' do - lambda { @server.sysaccept }.should block_caller + -> { @server.sysaccept }.should block_caller end it 'returns file descriptor of an accepted connection' do @@ -41,7 +41,7 @@ describe 'TCPServer#sysaccept' do describe 'without a connected client' do it 'blocks the caller' do - lambda { @server.sysaccept }.should block_caller + -> { @server.sysaccept }.should block_caller end end diff --git a/spec/ruby/library/socket/tcpsocket/initialize_spec.rb b/spec/ruby/library/socket/tcpsocket/initialize_spec.rb index a3593f0d5f..a3cee05412 100644 --- a/spec/ruby/library/socket/tcpsocket/initialize_spec.rb +++ b/spec/ruby/library/socket/tcpsocket/initialize_spec.rb @@ -5,7 +5,7 @@ describe 'TCPSocket#initialize' do SocketSpecs.each_ip_protocol do |family, ip_address| describe 'when no server is listening on the given address' do it 'raises Errno::ECONNREFUSED' do - lambda { TCPSocket.new(ip_address, 666) }.should raise_error(Errno::ECONNREFUSED) + -> { TCPSocket.new(ip_address, 666) }.should raise_error(Errno::ECONNREFUSED) end end @@ -31,7 +31,7 @@ describe 'TCPSocket#initialize' do end it 'raises SocketError when the port number is a non numeric String' do - lambda { TCPSocket.new(ip_address, 'cats') }.should raise_error(SocketError) + -> { TCPSocket.new(ip_address, 'cats') }.should raise_error(SocketError) end it 'set the socket to binmode' do diff --git a/spec/ruby/library/socket/tcpsocket/shared/new.rb b/spec/ruby/library/socket/tcpsocket/shared/new.rb index d0358923c9..5ca3a0e6cc 100644 --- a/spec/ruby/library/socket/tcpsocket/shared/new.rb +++ b/spec/ruby/library/socket/tcpsocket/shared/new.rb @@ -3,11 +3,11 @@ require_relative '../../fixtures/classes' describe :tcpsocket_new, shared: true do it "requires a hostname and a port as arguments" do - lambda { TCPSocket.send(@method) }.should raise_error(ArgumentError) + -> { TCPSocket.send(@method) }.should raise_error(ArgumentError) end it "refuses the connection when there is no server to connect to" do - lambda do + -> do TCPSocket.send(@method, SocketSpecs.hostname, SocketSpecs.reserved_unused_port) end.should raise_error(SystemCallError) {|e| [Errno::ECONNREFUSED, Errno::EADDRNOTAVAIL].should include(e.class) diff --git a/spec/ruby/library/socket/udpsocket/bind_spec.rb b/spec/ruby/library/socket/udpsocket/bind_spec.rb index 4dbdb285f6..08b386e941 100644 --- a/spec/ruby/library/socket/udpsocket/bind_spec.rb +++ b/spec/ruby/library/socket/udpsocket/bind_spec.rb @@ -18,7 +18,7 @@ describe "UDPSocket#bind" do it "raises Errno::EINVAL when already bound" do @socket.bind(SocketSpecs.hostname, 0) - lambda { + -> { @socket.bind(SocketSpecs.hostname, @socket.addr[1]) }.should raise_error(Errno::EINVAL) end diff --git a/spec/ruby/library/socket/udpsocket/new_spec.rb b/spec/ruby/library/socket/udpsocket/new_spec.rb index 157ff138be..6cc0cadbcb 100644 --- a/spec/ruby/library/socket/udpsocket/new_spec.rb +++ b/spec/ruby/library/socket/udpsocket/new_spec.rb @@ -27,7 +27,7 @@ describe 'UDPSocket.new' do end it 'raises Errno::EAFNOSUPPORT or Errno::EPROTONOSUPPORT if unsupported family passed' do - lambda { UDPSocket.new(-1) }.should raise_error(SystemCallError) { |e| + -> { UDPSocket.new(-1) }.should raise_error(SystemCallError) { |e| [Errno::EAFNOSUPPORT, Errno::EPROTONOSUPPORT].should include(e.class) } end diff --git a/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb b/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb index fb88a2dc13..c66d1df84d 100644 --- a/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb +++ b/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb @@ -16,7 +16,7 @@ describe 'UDPSocket#recvfrom_nonblock' do platform_is_not :windows do describe 'using an unbound socket' do it 'raises IO::WaitReadable' do - lambda { @server.recvfrom_nonblock(1) }.should raise_error(IO::WaitReadable) + -> { @server.recvfrom_nonblock(1) }.should raise_error(IO::WaitReadable) end end end @@ -32,7 +32,7 @@ describe 'UDPSocket#recvfrom_nonblock' do describe 'without any data available' do it 'raises IO::WaitReadable' do - lambda { @server.recvfrom_nonblock(1) }.should raise_error(IO::WaitReadable) + -> { @server.recvfrom_nonblock(1) }.should raise_error(IO::WaitReadable) end it 'returns :wait_readable with exception: false' do diff --git a/spec/ruby/library/socket/udpsocket/send_spec.rb b/spec/ruby/library/socket/udpsocket/send_spec.rb index 431129723e..5d5de684af 100644 --- a/spec/ruby/library/socket/udpsocket/send_spec.rb +++ b/spec/ruby/library/socket/udpsocket/send_spec.rb @@ -66,7 +66,7 @@ describe "UDPSocket#send" do it "raises EMSGSIZE if data is too too big" do @socket = UDPSocket.open begin - lambda do + -> do @socket.send('1' * 100_000, 0, SocketSpecs.hostname, @port.to_s) end.should raise_error(Errno::EMSGSIZE) ensure @@ -96,7 +96,7 @@ describe 'UDPSocket#send' do describe 'using a disconnected socket' do describe 'without a destination address' do it "raises #{SocketSpecs.dest_addr_req_error}" do - lambda { @client.send('hello', 0) }.should raise_error(SocketSpecs.dest_addr_req_error) + -> { @client.send('hello', 0) }.should raise_error(SocketSpecs.dest_addr_req_error) end end @@ -108,7 +108,7 @@ describe 'UDPSocket#send' do it 'does not persist the connection after sending data' do @client.send('hello', 0, @addr.ip_address, @addr.ip_port) - lambda { @client.send('hello', 0) }.should raise_error(SocketSpecs.dest_addr_req_error) + -> { @client.send('hello', 0) }.should raise_error(SocketSpecs.dest_addr_req_error) end end @@ -144,7 +144,7 @@ describe 'UDPSocket#send' do it 'sends the data to the given address instead' do @client.send('hello', 0, @alt_server.getsockname).should == 5 - lambda { @server.recv(5) }.should block_caller + -> { @server.recv(5) }.should block_caller @alt_server.recv(5).should == 'hello' end diff --git a/spec/ruby/library/socket/udpsocket/write_spec.rb b/spec/ruby/library/socket/udpsocket/write_spec.rb index e960de1baf..c971f29b62 100644 --- a/spec/ruby/library/socket/udpsocket/write_spec.rb +++ b/spec/ruby/library/socket/udpsocket/write_spec.rb @@ -10,7 +10,7 @@ describe "UDPSocket#write" do s2 = UDPSocket.new s2.connect(host, s1.addr[1]) - lambda do + -> do s2.write('1' * 100_000) end.should raise_error(Errno::EMSGSIZE) ensure diff --git a/spec/ruby/library/socket/unixserver/accept_nonblock_spec.rb b/spec/ruby/library/socket/unixserver/accept_nonblock_spec.rb index 3ebe38a090..30688b46b6 100644 --- a/spec/ruby/library/socket/unixserver/accept_nonblock_spec.rb +++ b/spec/ruby/library/socket/unixserver/accept_nonblock_spec.rb @@ -49,7 +49,7 @@ with_feature :unix_socket do describe 'without a client' do it 'raises IO::WaitReadable' do - lambda { @server.accept_nonblock }.should raise_error(IO::WaitReadable) + -> { @server.accept_nonblock }.should raise_error(IO::WaitReadable) end end diff --git a/spec/ruby/library/socket/unixserver/accept_spec.rb b/spec/ruby/library/socket/unixserver/accept_spec.rb index a1570f7013..c05fbe7f22 100644 --- a/spec/ruby/library/socket/unixserver/accept_spec.rb +++ b/spec/ruby/library/socket/unixserver/accept_spec.rb @@ -74,7 +74,7 @@ with_feature :unix_socket do describe 'without a client' do it 'blocks the calling thread' do - lambda { @server.accept }.should block_caller + -> { @server.accept }.should block_caller end end diff --git a/spec/ruby/library/socket/unixserver/initialize_spec.rb b/spec/ruby/library/socket/unixserver/initialize_spec.rb index cb186ceb76..0cc49ef1eb 100644 --- a/spec/ruby/library/socket/unixserver/initialize_spec.rb +++ b/spec/ruby/library/socket/unixserver/initialize_spec.rb @@ -22,7 +22,7 @@ with_feature :unix_socket do end it 'raises Errno::EADDRINUSE when the socket is already in use' do - lambda { UNIXServer.new(@path) }.should raise_error(Errno::EADDRINUSE) + -> { UNIXServer.new(@path) }.should raise_error(Errno::EADDRINUSE) end end end diff --git a/spec/ruby/library/socket/unixserver/sysaccept_spec.rb b/spec/ruby/library/socket/unixserver/sysaccept_spec.rb index 65a35c91a9..e59731878a 100644 --- a/spec/ruby/library/socket/unixserver/sysaccept_spec.rb +++ b/spec/ruby/library/socket/unixserver/sysaccept_spec.rb @@ -16,7 +16,7 @@ with_feature :unix_socket do describe 'without a client' do it 'blocks the calling thread' do - lambda { @server.sysaccept }.should block_caller + -> { @server.sysaccept }.should block_caller end end diff --git a/spec/ruby/library/socket/unixsocket/initialize_spec.rb b/spec/ruby/library/socket/unixsocket/initialize_spec.rb index a6217d404f..13b6972f03 100644 --- a/spec/ruby/library/socket/unixsocket/initialize_spec.rb +++ b/spec/ruby/library/socket/unixsocket/initialize_spec.rb @@ -5,7 +5,7 @@ with_feature :unix_socket do describe 'UNIXSocket#initialize' do describe 'using a non existing path' do it 'raises Errno::ENOENT' do - lambda { UNIXSocket.new(SocketSpecs.socket_path) }.should raise_error(Errno::ENOENT) + -> { UNIXSocket.new(SocketSpecs.socket_path) }.should raise_error(Errno::ENOENT) end end diff --git a/spec/ruby/library/socket/unixsocket/peeraddr_spec.rb b/spec/ruby/library/socket/unixsocket/peeraddr_spec.rb index e39c8a0570..0b6b1ccf04 100644 --- a/spec/ruby/library/socket/unixsocket/peeraddr_spec.rb +++ b/spec/ruby/library/socket/unixsocket/peeraddr_spec.rb @@ -21,7 +21,7 @@ describe "UNIXSocket#peeraddr" do end it "raises an error in server sockets" do - lambda { + -> { @server.peeraddr }.should raise_error(Errno::ENOTCONN) end diff --git a/spec/ruby/library/stringio/append_spec.rb b/spec/ruby/library/stringio/append_spec.rb index 08500bc520..a8bc6aabdb 100644 --- a/spec/ruby/library/stringio/append_spec.rb +++ b/spec/ruby/library/stringio/append_spec.rb @@ -55,11 +55,11 @@ end describe "StringIO#<< when self is not writable" do it "raises an IOError" do io = StringIO.new("test", "r") - lambda { io << "test" }.should raise_error(IOError) + -> { io << "test" }.should raise_error(IOError) io = StringIO.new("test") io.close_write - lambda { io << "test" }.should raise_error(IOError) + -> { io << "test" }.should raise_error(IOError) end end diff --git a/spec/ruby/library/stringio/close_read_spec.rb b/spec/ruby/library/stringio/close_read_spec.rb index 05d6c9f7d2..80bd547e85 100644 --- a/spec/ruby/library/stringio/close_read_spec.rb +++ b/spec/ruby/library/stringio/close_read_spec.rb @@ -12,7 +12,7 @@ describe "StringIO#close_read" do it "prevents further reading" do @io.close_read - lambda { @io.read(1) }.should raise_error(IOError) + -> { @io.read(1) }.should raise_error(IOError) end it "allows further writing" do @@ -22,7 +22,7 @@ describe "StringIO#close_read" do it "raises an IOError when in write-only mode" do io = StringIO.new("example", "w") - lambda { io.close_read }.should raise_error(IOError) + -> { io.close_read }.should raise_error(IOError) io = StringIO.new("example") io.close_read diff --git a/spec/ruby/library/stringio/close_spec.rb b/spec/ruby/library/stringio/close_spec.rb index a5a931aff1..520a8de782 100644 --- a/spec/ruby/library/stringio/close_spec.rb +++ b/spec/ruby/library/stringio/close_spec.rb @@ -12,12 +12,12 @@ describe "StringIO#close" do it "prevents further reading and/or writing" do @io.close - lambda { @io.read(1) }.should raise_error(IOError) - lambda { @io.write('x') }.should raise_error(IOError) + -> { @io.read(1) }.should raise_error(IOError) + -> { @io.write('x') }.should raise_error(IOError) end it "does not raise anything when self was already closed" do @io.close - lambda { @io.close }.should_not raise_error(IOError) + -> { @io.close }.should_not raise_error(IOError) end end diff --git a/spec/ruby/library/stringio/close_write_spec.rb b/spec/ruby/library/stringio/close_write_spec.rb index 8a7ac12581..1a4cfa113e 100644 --- a/spec/ruby/library/stringio/close_write_spec.rb +++ b/spec/ruby/library/stringio/close_write_spec.rb @@ -12,7 +12,7 @@ describe "StringIO#close_write" do it "prevents further writing" do @io.close_write - lambda { @io.write('x') }.should raise_error(IOError) + -> { @io.write('x') }.should raise_error(IOError) end it "allows further reading" do @@ -22,7 +22,7 @@ describe "StringIO#close_write" do it "raises an IOError when in read-only mode" do io = StringIO.new("example", "r") - lambda { io.close_write }.should raise_error(IOError) + -> { io.close_write }.should raise_error(IOError) io = StringIO.new("example") io.close_write diff --git a/spec/ruby/library/stringio/fcntl_spec.rb b/spec/ruby/library/stringio/fcntl_spec.rb index e4133c0d06..a78004d868 100644 --- a/spec/ruby/library/stringio/fcntl_spec.rb +++ b/spec/ruby/library/stringio/fcntl_spec.rb @@ -3,6 +3,6 @@ require_relative 'fixtures/classes' describe "StringIO#fcntl" do it "raises a NotImplementedError" do - lambda { StringIO.new("boom").fcntl }.should raise_error(NotImplementedError) + -> { StringIO.new("boom").fcntl }.should raise_error(NotImplementedError) end end diff --git a/spec/ruby/library/stringio/gets_spec.rb b/spec/ruby/library/stringio/gets_spec.rb index d682b2784f..69880672a3 100644 --- a/spec/ruby/library/stringio/gets_spec.rb +++ b/spec/ruby/library/stringio/gets_spec.rb @@ -229,11 +229,11 @@ end describe "StringIO#gets when in write-only mode" do it "raises an IOError" do io = StringIO.new("xyz", "w") - lambda { io.gets }.should raise_error(IOError) + -> { io.gets }.should raise_error(IOError) io = StringIO.new("xyz") io.close_read - lambda { io.gets }.should raise_error(IOError) + -> { io.gets }.should raise_error(IOError) end end diff --git a/spec/ruby/library/stringio/initialize_spec.rb b/spec/ruby/library/stringio/initialize_spec.rb index b503ed2206..cc4f4c9254 100644 --- a/spec/ruby/library/stringio/initialize_spec.rb +++ b/spec/ruby/library/stringio/initialize_spec.rb @@ -112,7 +112,7 @@ describe "StringIO#initialize when passed [Object, mode]" do it "raises a #{frozen_error_class} when passed a frozen String in truncate mode as StringIO backend" do io = StringIO.allocate - lambda { io.send(:initialize, "example".freeze, IO::TRUNC) }.should raise_error(frozen_error_class) + -> { io.send(:initialize, "example".freeze, IO::TRUNC) }.should raise_error(frozen_error_class) end it "tries to convert the passed mode to a String using #to_str" do @@ -126,9 +126,9 @@ describe "StringIO#initialize when passed [Object, mode]" do it "raises an Errno::EACCES error when passed a frozen string with a write-mode" do (str = "example").freeze - lambda { @io.send(:initialize, str, "r+") }.should raise_error(Errno::EACCES) - lambda { @io.send(:initialize, str, "w") }.should raise_error(Errno::EACCES) - lambda { @io.send(:initialize, str, "a") }.should raise_error(Errno::EACCES) + -> { @io.send(:initialize, str, "r+") }.should raise_error(Errno::EACCES) + -> { @io.send(:initialize, str, "w") }.should raise_error(Errno::EACCES) + -> { @io.send(:initialize, str, "a") }.should raise_error(Errno::EACCES) end end diff --git a/spec/ruby/library/stringio/open_spec.rb b/spec/ruby/library/stringio/open_spec.rb index f8f3feabee..adb784c890 100644 --- a/spec/ruby/library/stringio/open_spec.rb +++ b/spec/ruby/library/stringio/open_spec.rb @@ -135,7 +135,7 @@ describe "StringIO.open when passed [Object, mode]" do end it "raises a #{frozen_error_class} when passed a frozen String in truncate mode as StringIO backend" do - lambda { StringIO.open("example".freeze, IO::TRUNC) }.should raise_error(frozen_error_class) + -> { StringIO.open("example".freeze, IO::TRUNC) }.should raise_error(frozen_error_class) end it "tries to convert the passed mode to a String using #to_str" do @@ -149,9 +149,9 @@ describe "StringIO.open when passed [Object, mode]" do it "raises an Errno::EACCES error when passed a frozen string with a write-mode" do (str = "example").freeze - lambda { StringIO.open(str, "r+") }.should raise_error(Errno::EACCES) - lambda { StringIO.open(str, "w") }.should raise_error(Errno::EACCES) - lambda { StringIO.open(str, "a") }.should raise_error(Errno::EACCES) + -> { StringIO.open(str, "r+") }.should raise_error(Errno::EACCES) + -> { StringIO.open(str, "w") }.should raise_error(Errno::EACCES) + -> { StringIO.open(str, "a") }.should raise_error(Errno::EACCES) end end diff --git a/spec/ruby/library/stringio/path_spec.rb b/spec/ruby/library/stringio/path_spec.rb index 5439cf4b53..1184ca523f 100644 --- a/spec/ruby/library/stringio/path_spec.rb +++ b/spec/ruby/library/stringio/path_spec.rb @@ -3,6 +3,6 @@ require_relative 'fixtures/classes' describe "StringIO#path" do it "is not defined" do - lambda { StringIO.new("path").path }.should raise_error(NoMethodError) + -> { StringIO.new("path").path }.should raise_error(NoMethodError) end end diff --git a/spec/ruby/library/stringio/pos_spec.rb b/spec/ruby/library/stringio/pos_spec.rb index 8d99294f31..81be5f01a5 100644 --- a/spec/ruby/library/stringio/pos_spec.rb +++ b/spec/ruby/library/stringio/pos_spec.rb @@ -17,7 +17,7 @@ describe "StringIO#pos=" do end it "raises an EINVAL if given a negative argument" do - lambda { @io.pos = -10 }.should raise_error(Errno::EINVAL) + -> { @io.pos = -10 }.should raise_error(Errno::EINVAL) end it "updates the current byte offset after reaching EOF" do diff --git a/spec/ruby/library/stringio/print_spec.rb b/spec/ruby/library/stringio/print_spec.rb index 144a219509..d0f07d1e50 100644 --- a/spec/ruby/library/stringio/print_spec.rb +++ b/spec/ruby/library/stringio/print_spec.rb @@ -91,10 +91,10 @@ end describe "StringIO#print when self is not writable" do it "raises an IOError" do io = StringIO.new("test", "r") - lambda { io.print("test") }.should raise_error(IOError) + -> { io.print("test") }.should raise_error(IOError) io = StringIO.new("test") io.close_write - lambda { io.print("test") }.should raise_error(IOError) + -> { io.print("test") }.should raise_error(IOError) end end diff --git a/spec/ruby/library/stringio/printf_spec.rb b/spec/ruby/library/stringio/printf_spec.rb index 3978896621..f88ca1eb20 100644 --- a/spec/ruby/library/stringio/printf_spec.rb +++ b/spec/ruby/library/stringio/printf_spec.rb @@ -31,7 +31,7 @@ describe "StringIO#printf" do end describe "formatting" do - it_behaves_like :kernel_sprintf, -> (format, *args) { + it_behaves_like :kernel_sprintf, -> format, *args { io = StringIO.new io.printf(format, *args) io.string @@ -61,10 +61,10 @@ end describe "StringIO#printf when self is not writable" do it "raises an IOError" do io = StringIO.new("test", "r") - lambda { io.printf("test") }.should raise_error(IOError) + -> { io.printf("test") }.should raise_error(IOError) io = StringIO.new("test") io.close_write - lambda { io.printf("test") }.should raise_error(IOError) + -> { io.printf("test") }.should raise_error(IOError) end end diff --git a/spec/ruby/library/stringio/putc_spec.rb b/spec/ruby/library/stringio/putc_spec.rb index eae5481d6e..223b3523e5 100644 --- a/spec/ruby/library/stringio/putc_spec.rb +++ b/spec/ruby/library/stringio/putc_spec.rb @@ -64,7 +64,7 @@ describe "StringIO#putc when passed [Object]" do end it "raises a TypeError when the passed argument can't be coerced to Integer" do - lambda { @io.putc(Object.new) }.should raise_error(TypeError) + -> { @io.putc(Object.new) }.should raise_error(TypeError) end end @@ -79,10 +79,10 @@ end describe "StringIO#putc when self is not writable" do it "raises an IOError" do io = StringIO.new("test", "r") - lambda { io.putc(?a) }.should raise_error(IOError) + -> { io.putc(?a) }.should raise_error(IOError) io = StringIO.new("test") io.close_write - lambda { io.putc("t") }.should raise_error(IOError) + -> { io.putc("t") }.should raise_error(IOError) end end diff --git a/spec/ruby/library/stringio/puts_spec.rb b/spec/ruby/library/stringio/puts_spec.rb index 152bfb13f8..2d3db25c5f 100644 --- a/spec/ruby/library/stringio/puts_spec.rb +++ b/spec/ruby/library/stringio/puts_spec.rb @@ -148,11 +148,11 @@ end describe "StringIO#puts when self is not writable" do it "raises an IOError" do io = StringIO.new("test", "r") - lambda { io.puts }.should raise_error(IOError) + -> { io.puts }.should raise_error(IOError) io = StringIO.new("test") io.close_write - lambda { io.puts }.should raise_error(IOError) + -> { io.puts }.should raise_error(IOError) end end diff --git a/spec/ruby/library/stringio/readline_spec.rb b/spec/ruby/library/stringio/readline_spec.rb index dc396f61a9..9af633472e 100644 --- a/spec/ruby/library/stringio/readline_spec.rb +++ b/spec/ruby/library/stringio/readline_spec.rb @@ -106,18 +106,18 @@ describe "StringIO#readline when passed no argument" do it "raises an IOError if self is at the end" do @io.pos = 40 - lambda { @io.readline }.should raise_error(IOError) + -> { @io.readline }.should raise_error(IOError) end end describe "StringIO#readline when in write-only mode" do it "raises an IOError" do io = StringIO.new("xyz", "w") - lambda { io.readline }.should raise_error(IOError) + -> { io.readline }.should raise_error(IOError) io = StringIO.new("xyz") io.close_read - lambda { io.readline }.should raise_error(IOError) + -> { io.readline }.should raise_error(IOError) end end diff --git a/spec/ruby/library/stringio/readlines_spec.rb b/spec/ruby/library/stringio/readlines_spec.rb index 840470c09c..7f9f9f5846 100644 --- a/spec/ruby/library/stringio/readlines_spec.rb +++ b/spec/ruby/library/stringio/readlines_spec.rb @@ -83,11 +83,11 @@ end describe "StringIO#readlines when in write-only mode" do it "raises an IOError" do io = StringIO.new("xyz", "w") - lambda { io.readlines }.should raise_error(IOError) + -> { io.readlines }.should raise_error(IOError) io = StringIO.new("xyz") io.close_read - lambda { io.readlines }.should raise_error(IOError) + -> { io.readlines }.should raise_error(IOError) end end diff --git a/spec/ruby/library/stringio/readpartial_spec.rb b/spec/ruby/library/stringio/readpartial_spec.rb index 54e2f47004..2601fe8c42 100644 --- a/spec/ruby/library/stringio/readpartial_spec.rb +++ b/spec/ruby/library/stringio/readpartial_spec.rb @@ -12,7 +12,7 @@ describe "StringIO#readpartial" do it "raises IOError on closed stream" do @string.close - lambda { @string.readpartial(10) }.should raise_error(IOError) + -> { @string.readpartial(10) }.should raise_error(IOError) end it "reads at most the specified number of bytes" do @@ -55,23 +55,23 @@ describe "StringIO#readpartial" do it "raises EOFError on EOF" do @string.readpartial(18).should == 'Stop, look, listen' - lambda { @string.readpartial(10) }.should raise_error(EOFError) + -> { @string.readpartial(10) }.should raise_error(EOFError) end it "discards the existing buffer content upon error" do buffer = 'hello' @string.readpartial(100) - lambda { @string.readpartial(1, buffer) }.should raise_error(EOFError) + -> { @string.readpartial(1, buffer) }.should raise_error(EOFError) buffer.should be_empty end it "raises IOError if the stream is closed" do @string.close - lambda { @string.readpartial(1) }.should raise_error(IOError) + -> { @string.readpartial(1) }.should raise_error(IOError) end it "raises ArgumentError if the negative argument is provided" do - lambda { @string.readpartial(-1) }.should raise_error(ArgumentError) + -> { @string.readpartial(-1) }.should raise_error(ArgumentError) end it "immediately returns an empty string if the length argument is 0" do diff --git a/spec/ruby/library/stringio/reopen_spec.rb b/spec/ruby/library/stringio/reopen_spec.rb index 51aff43ba2..6b5bdb57a1 100644 --- a/spec/ruby/library/stringio/reopen_spec.rb +++ b/spec/ruby/library/stringio/reopen_spec.rb @@ -40,16 +40,16 @@ describe "StringIO#reopen when passed [Object, Integer]" do end it "raises a TypeError when the passed Object can't be converted to a String" do - lambda { @io.reopen(Object.new, IO::RDWR) }.should raise_error(TypeError) + -> { @io.reopen(Object.new, IO::RDWR) }.should raise_error(TypeError) end it "raises an Errno::EACCES when trying to reopen self with a frozen String in write-mode" do - lambda { @io.reopen("burn".freeze, IO::WRONLY) }.should raise_error(Errno::EACCES) - lambda { @io.reopen("burn".freeze, IO::WRONLY | IO::APPEND) }.should raise_error(Errno::EACCES) + -> { @io.reopen("burn".freeze, IO::WRONLY) }.should raise_error(Errno::EACCES) + -> { @io.reopen("burn".freeze, IO::WRONLY | IO::APPEND) }.should raise_error(Errno::EACCES) end it "raises a #{frozen_error_class} when trying to reopen self with a frozen String in truncate-mode" do - lambda { @io.reopen("burn".freeze, IO::RDONLY | IO::TRUNC) }.should raise_error(frozen_error_class) + -> { @io.reopen("burn".freeze, IO::RDONLY | IO::TRUNC) }.should raise_error(frozen_error_class) end it "does not raise IOError when passed a frozen String in read-mode" do @@ -107,7 +107,7 @@ describe "StringIO#reopen when passed [Object, Object]" do end it "raises a TypeError when the passed Object can't be converted to a String using #to_str" do - lambda { @io.reopen(Object.new, "r") }.should raise_error(TypeError) + -> { @io.reopen(Object.new, "r") }.should raise_error(TypeError) end it "resets self's position to 0" do @@ -132,10 +132,10 @@ describe "StringIO#reopen when passed [Object, Object]" do end it "raises an Errno::EACCES error when trying to reopen self with a frozen String in write-mode" do - lambda { @io.reopen("burn".freeze, 'w') }.should raise_error(Errno::EACCES) - lambda { @io.reopen("burn".freeze, 'w+') }.should raise_error(Errno::EACCES) - lambda { @io.reopen("burn".freeze, 'a') }.should raise_error(Errno::EACCES) - lambda { @io.reopen("burn".freeze, "r+") }.should raise_error(Errno::EACCES) + -> { @io.reopen("burn".freeze, 'w') }.should raise_error(Errno::EACCES) + -> { @io.reopen("burn".freeze, 'w+') }.should raise_error(Errno::EACCES) + -> { @io.reopen("burn".freeze, 'a') }.should raise_error(Errno::EACCES) + -> { @io.reopen("burn".freeze, "r+") }.should raise_error(Errno::EACCES) end it "does not raise IOError if a frozen string is passed in read mode" do @@ -185,13 +185,13 @@ describe "StringIO#reopen when passed [Object]" do end it "raises a TypeError when passed an Object that can't be converted to a StringIO" do - lambda { @io.reopen(Object.new) }.should raise_error(TypeError) + -> { @io.reopen(Object.new) }.should raise_error(TypeError) end it "does not try to convert the passed Object to a String using #to_str" do obj = mock("not to_str") obj.should_not_receive(:to_str) - lambda { @io.reopen(obj) }.should raise_error(TypeError) + -> { @io.reopen(obj) }.should raise_error(TypeError) end it "tries to convert the passed Object to a StringIO using #to_strio" do diff --git a/spec/ruby/library/stringio/seek_spec.rb b/spec/ruby/library/stringio/seek_spec.rb index b963b77eef..253b5027a9 100644 --- a/spec/ruby/library/stringio/seek_spec.rb +++ b/spec/ruby/library/stringio/seek_spec.rb @@ -33,14 +33,14 @@ describe "StringIO#seek" do end it "raises an Errno::EINVAL error on negative amounts when whence is IO::SEEK_SET" do - lambda { @io.seek(-5, IO::SEEK_SET) }.should raise_error(Errno::EINVAL) + -> { @io.seek(-5, IO::SEEK_SET) }.should raise_error(Errno::EINVAL) end it "raises an Errno::EINVAL error on incorrect whence argument" do - lambda { @io.seek(0, 3) }.should raise_error(Errno::EINVAL) - lambda { @io.seek(0, -1) }.should raise_error(Errno::EINVAL) - lambda { @io.seek(0, 2**16) }.should raise_error(Errno::EINVAL) - lambda { @io.seek(0, -2**16) }.should raise_error(Errno::EINVAL) + -> { @io.seek(0, 3) }.should raise_error(Errno::EINVAL) + -> { @io.seek(0, -1) }.should raise_error(Errno::EINVAL) + -> { @io.seek(0, 2**16) }.should raise_error(Errno::EINVAL) + -> { @io.seek(0, -2**16) }.should raise_error(Errno::EINVAL) end it "tries to convert the passed Object to a String using #to_int" do @@ -51,7 +51,7 @@ describe "StringIO#seek" do end it "raises a TypeError when the passed Object can't be converted to an Integer" do - lambda { @io.seek(Object.new) }.should raise_error(TypeError) + -> { @io.seek(Object.new) }.should raise_error(TypeError) end end @@ -62,6 +62,6 @@ describe "StringIO#seek when self is closed" do end it "raises an IOError" do - lambda { @io.seek(5) }.should raise_error(IOError) + -> { @io.seek(5) }.should raise_error(IOError) end end diff --git a/spec/ruby/library/stringio/shared/codepoints.rb b/spec/ruby/library/stringio/shared/codepoints.rb index c8ca03329f..9d84aa4919 100644 --- a/spec/ruby/library/stringio/shared/codepoints.rb +++ b/spec/ruby/library/stringio/shared/codepoints.rb @@ -20,15 +20,15 @@ describe :stringio_codepoints, shared: true do it "raises an error if reading invalid sequence" do @io.pos = 1 # inside of a multibyte sequence - lambda { @enum.first }.should raise_error(ArgumentError) + -> { @enum.first }.should raise_error(ArgumentError) end it "raises an IOError if not readable" do @io.close_read - lambda { @enum.to_a }.should raise_error(IOError) + -> { @enum.to_a }.should raise_error(IOError) io = StringIO.new("xyz", "w") - lambda { io.send(@method).to_a }.should raise_error(IOError) + -> { io.send(@method).to_a }.should raise_error(IOError) end diff --git a/spec/ruby/library/stringio/shared/each.rb b/spec/ruby/library/stringio/shared/each.rb index 55ed27c1c7..c08d40344c 100644 --- a/spec/ruby/library/stringio/shared/each.rb +++ b/spec/ruby/library/stringio/shared/each.rb @@ -96,11 +96,11 @@ end describe :stringio_each_not_readable, shared: true do it "raises an IOError" do io = StringIO.new("a b c d e", "w") - lambda { io.send(@method) { |b| b } }.should raise_error(IOError) + -> { io.send(@method) { |b| b } }.should raise_error(IOError) io = StringIO.new("a b c d e") io.close_read - lambda { io.send(@method) { |b| b } }.should raise_error(IOError) + -> { io.send(@method) { |b| b } }.should raise_error(IOError) end end diff --git a/spec/ruby/library/stringio/shared/each_byte.rb b/spec/ruby/library/stringio/shared/each_byte.rb index 1dc48ee437..56734ff99d 100644 --- a/spec/ruby/library/stringio/shared/each_byte.rb +++ b/spec/ruby/library/stringio/shared/each_byte.rb @@ -39,10 +39,10 @@ end describe :stringio_each_byte_not_readable, shared: true do it "raises an IOError" do io = StringIO.new("xyz", "w") - lambda { io.send(@method) { |b| b } }.should raise_error(IOError) + -> { io.send(@method) { |b| b } }.should raise_error(IOError) io = StringIO.new("xyz") io.close_read - lambda { io.send(@method) { |b| b } }.should raise_error(IOError) + -> { io.send(@method) { |b| b } }.should raise_error(IOError) end end diff --git a/spec/ruby/library/stringio/shared/each_char.rb b/spec/ruby/library/stringio/shared/each_char.rb index 35efdcb749..bcdac53282 100644 --- a/spec/ruby/library/stringio/shared/each_char.rb +++ b/spec/ruby/library/stringio/shared/each_char.rb @@ -27,10 +27,10 @@ end describe :stringio_each_char_not_readable, shared: true do it "raises an IOError" do io = StringIO.new("xyz", "w") - lambda { io.send(@method) { |b| b } }.should raise_error(IOError) + -> { io.send(@method) { |b| b } }.should raise_error(IOError) io = StringIO.new("xyz") io.close_read - lambda { io.send(@method) { |b| b } }.should raise_error(IOError) + -> { io.send(@method) { |b| b } }.should raise_error(IOError) end end diff --git a/spec/ruby/library/stringio/shared/getc.rb b/spec/ruby/library/stringio/shared/getc.rb index 3e064f9c1e..6318bcc30f 100644 --- a/spec/ruby/library/stringio/shared/getc.rb +++ b/spec/ruby/library/stringio/shared/getc.rb @@ -34,10 +34,10 @@ end describe :stringio_getc_not_readable, shared: true do it "raises an IOError" do io = StringIO.new("xyz", "w") - lambda { io.send(@method) }.should raise_error(IOError) + -> { io.send(@method) }.should raise_error(IOError) io = StringIO.new("xyz") io.close_read - lambda { io.send(@method) }.should raise_error(IOError) + -> { io.send(@method) }.should raise_error(IOError) end end diff --git a/spec/ruby/library/stringio/shared/read.rb b/spec/ruby/library/stringio/shared/read.rb index 139c4fb02f..15ce58ae6a 100644 --- a/spec/ruby/library/stringio/shared/read.rb +++ b/spec/ruby/library/stringio/shared/read.rb @@ -24,11 +24,11 @@ describe :stringio_read, shared: true do end it "raises a TypeError when the passed buffer Object can't be converted to a String" do - lambda { @io.send(@method, 7, Object.new) }.should raise_error(TypeError) + -> { @io.send(@method, 7, Object.new) }.should raise_error(TypeError) end it "raises a #{frozen_error_class} error when passed a frozen String as buffer" do - lambda { @io.send(@method, 7, "".freeze) }.should raise_error(frozen_error_class) + -> { @io.send(@method, 7, "".freeze) }.should raise_error(frozen_error_class) end end @@ -61,11 +61,11 @@ describe :stringio_read_length, shared: true do end it "raises a TypeError when the passed length can't be converted to an Integer" do - lambda { @io.send(@method, Object.new) }.should raise_error(TypeError) + -> { @io.send(@method, Object.new) }.should raise_error(TypeError) end it "raises a TypeError when the passed length is negative" do - lambda { @io.send(@method, -2) }.should raise_error(ArgumentError) + -> { @io.send(@method, -2) }.should raise_error(ArgumentError) end it "returns a binary String" do @@ -112,10 +112,10 @@ end describe :stringio_read_not_readable, shared: true do it "raises an IOError" do io = StringIO.new("test", "w") - lambda { io.send(@method) }.should raise_error(IOError) + -> { io.send(@method) }.should raise_error(IOError) io = StringIO.new("test") io.close_read - lambda { io.send(@method) }.should raise_error(IOError) + -> { io.send(@method) }.should raise_error(IOError) end end diff --git a/spec/ruby/library/stringio/shared/readchar.rb b/spec/ruby/library/stringio/shared/readchar.rb index 19194f0680..4248e75420 100644 --- a/spec/ruby/library/stringio/shared/readchar.rb +++ b/spec/ruby/library/stringio/shared/readchar.rb @@ -13,17 +13,17 @@ describe :stringio_readchar, shared: true do it "raises an EOFError when self is at the end" do @io.pos = 7 - lambda { @io.send(@method) }.should raise_error(EOFError) + -> { @io.send(@method) }.should raise_error(EOFError) end end describe :stringio_readchar_not_readable, shared: true do it "raises an IOError" do io = StringIO.new("a b c d e", "w") - lambda { io.send(@method) }.should raise_error(IOError) + -> { io.send(@method) }.should raise_error(IOError) io = StringIO.new("a b c d e") io.close_read - lambda { io.send(@method) }.should raise_error(IOError) + -> { io.send(@method) }.should raise_error(IOError) end end diff --git a/spec/ruby/library/stringio/shared/sysread.rb b/spec/ruby/library/stringio/shared/sysread.rb index 9800b2339b..3376bd9907 100644 --- a/spec/ruby/library/stringio/shared/sysread.rb +++ b/spec/ruby/library/stringio/shared/sysread.rb @@ -10,6 +10,6 @@ describe :stringio_sysread_length, :shared => true do it "raises an EOFError when passed length > 0 and no data remains" do @io.read.should == "example" - lambda { @io.sysread(1) }.should raise_error(EOFError) + -> { @io.sysread(1) }.should raise_error(EOFError) end end diff --git a/spec/ruby/library/stringio/shared/write.rb b/spec/ruby/library/stringio/shared/write.rb index bcb548bbd0..df4822cc16 100644 --- a/spec/ruby/library/stringio/shared/write.rb +++ b/spec/ruby/library/stringio/shared/write.rb @@ -59,11 +59,11 @@ end describe :stringio_write_not_writable, shared: true do it "raises an IOError" do io = StringIO.new("test", "r") - lambda { io.send(@method, "test") }.should raise_error(IOError) + -> { io.send(@method, "test") }.should raise_error(IOError) io = StringIO.new("test") io.close_write - lambda { io.send(@method, "test") }.should raise_error(IOError) + -> { io.send(@method, "test") }.should raise_error(IOError) end end diff --git a/spec/ruby/library/stringio/string_spec.rb b/spec/ruby/library/stringio/string_spec.rb index 384986c161..1ed5233ba6 100644 --- a/spec/ruby/library/stringio/string_spec.rb +++ b/spec/ruby/library/stringio/string_spec.rb @@ -45,6 +45,6 @@ describe "StringIO#string=" do end it "raises a TypeError when the passed Object can't be converted to an Integer" do - lambda { @io.seek(Object.new) }.should raise_error(TypeError) + -> { @io.seek(Object.new) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/stringio/sysread_spec.rb b/spec/ruby/library/stringio/sysread_spec.rb index ee69801444..8f78073f42 100644 --- a/spec/ruby/library/stringio/sysread_spec.rb +++ b/spec/ruby/library/stringio/sysread_spec.rb @@ -39,7 +39,7 @@ describe "StringIO#sysread when passed [length]" do it "raises an EOFError when self's position is at the end" do @io.pos = 7 - lambda { @io.sysread(10) }.should raise_error(EOFError) + -> { @io.sysread(10) }.should raise_error(EOFError) end it "returns an empty String when length is 0" do diff --git a/spec/ruby/library/stringio/truncate_spec.rb b/spec/ruby/library/stringio/truncate_spec.rb index d0d61af70a..ba910ee98c 100644 --- a/spec/ruby/library/stringio/truncate_spec.rb +++ b/spec/ruby/library/stringio/truncate_spec.rb @@ -35,8 +35,8 @@ describe "StringIO#truncate when passed [length]" do end it "raises an Errno::EINVAL when the passed length is negative" do - lambda { @io.truncate(-1) }.should raise_error(Errno::EINVAL) - lambda { @io.truncate(-10) }.should raise_error(Errno::EINVAL) + -> { @io.truncate(-1) }.should raise_error(Errno::EINVAL) + -> { @io.truncate(-10) }.should raise_error(Errno::EINVAL) end it "tries to convert the passed length to an Integer using #to_int" do @@ -54,17 +54,17 @@ describe "StringIO#truncate when passed [length]" do end it "raises a TypeError when the passed length can't be converted to an Integer" do - lambda { @io.truncate(Object.new) }.should raise_error(TypeError) + -> { @io.truncate(Object.new) }.should raise_error(TypeError) end end describe "StringIO#truncate when self is not writable" do it "raises an IOError" do io = StringIO.new("test", "r") - lambda { io.truncate(2) }.should raise_error(IOError) + -> { io.truncate(2) }.should raise_error(IOError) io = StringIO.new("test") io.close_write - lambda { io.truncate(2) }.should raise_error(IOError) + -> { io.truncate(2) }.should raise_error(IOError) end end diff --git a/spec/ruby/library/stringio/ungetc_spec.rb b/spec/ruby/library/stringio/ungetc_spec.rb index 8a9205f390..91ef2100a1 100644 --- a/spec/ruby/library/stringio/ungetc_spec.rb +++ b/spec/ruby/library/stringio/ungetc_spec.rb @@ -39,7 +39,7 @@ describe "StringIO#ungetc when passed [char]" do end it "raises a TypeError when the passed length can't be converted to an Integer or String" do - lambda { @io.ungetc(Object.new) }.should raise_error(TypeError) + -> { @io.ungetc(Object.new) }.should raise_error(TypeError) end end @@ -47,12 +47,12 @@ describe "StringIO#ungetc when self is not readable" do it "raises an IOError" do io = StringIO.new("test", "w") io.pos = 1 - lambda { io.ungetc(?A) }.should raise_error(IOError) + -> { io.ungetc(?A) }.should raise_error(IOError) io = StringIO.new("test") io.pos = 1 io.close_read - lambda { io.ungetc(?A) }.should raise_error(IOError) + -> { io.ungetc(?A) }.should raise_error(IOError) end end diff --git a/spec/ruby/library/stringscanner/clear_spec.rb b/spec/ruby/library/stringscanner/clear_spec.rb index c8b19abe7d..7ae089704a 100644 --- a/spec/ruby/library/stringscanner/clear_spec.rb +++ b/spec/ruby/library/stringscanner/clear_spec.rb @@ -7,11 +7,11 @@ describe "StringScanner#clear" do it "warns in verbose mode that the method is obsolete" do s = StringScanner.new("abc") - lambda { + -> { s.clear }.should complain(/clear.*obsolete.*terminate/, verbose: true) - lambda { + -> { s.clear }.should_not complain(verbose: false) end diff --git a/spec/ruby/library/stringscanner/element_reference_spec.rb b/spec/ruby/library/stringscanner/element_reference_spec.rb index c3fab16bbc..60fe15d807 100644 --- a/spec/ruby/library/stringscanner/element_reference_spec.rb +++ b/spec/ruby/library/stringscanner/element_reference_spec.rb @@ -34,18 +34,18 @@ describe "StringScanner#[]" do it "raises a TypeError if the given index is nil" do @s.scan(/(\w+) (\w+) (\d+) /) - lambda { @s[nil]}.should raise_error(TypeError) + -> { @s[nil]}.should raise_error(TypeError) end it "raises a TypeError when a Range is as argument" do @s.scan(/(\w+) (\w+) (\d+) /) - lambda { @s[0..2]}.should raise_error(TypeError) + -> { @s[0..2]}.should raise_error(TypeError) end it "raises a IndexError when there's no named capture" do @s.scan(/(\w+) (\w+) (\d+) /) - lambda { @s["wday"]}.should raise_error(IndexError) - lambda { @s[:wday]}.should raise_error(IndexError) + -> { @s["wday"]}.should raise_error(IndexError) + -> { @s[:wday]}.should raise_error(IndexError) end it "returns named capture" do diff --git a/spec/ruby/library/stringscanner/empty_spec.rb b/spec/ruby/library/stringscanner/empty_spec.rb index 0b67d23246..d9449bea6e 100644 --- a/spec/ruby/library/stringscanner/empty_spec.rb +++ b/spec/ruby/library/stringscanner/empty_spec.rb @@ -7,11 +7,11 @@ describe "StringScanner#empty?" do it "warns in verbose mode that the method is obsolete" do s = StringScanner.new("abc") - lambda { + -> { s.empty? }.should complain(/empty?.*obsolete.*eos?/, verbose: true) - lambda { + -> { s.empty? }.should_not complain(verbose: false) end diff --git a/spec/ruby/library/stringscanner/getbyte_spec.rb b/spec/ruby/library/stringscanner/getbyte_spec.rb index 102aa5325d..e0659a5829 100644 --- a/spec/ruby/library/stringscanner/getbyte_spec.rb +++ b/spec/ruby/library/stringscanner/getbyte_spec.rb @@ -8,11 +8,11 @@ describe "StringScanner#getbyte" do it "warns in verbose mode that the method is obsolete" do s = StringScanner.new("abc") - lambda { + -> { s.getbyte }.should complain(/getbyte.*obsolete.*get_byte/, verbose: true) - lambda { + -> { s.getbyte }.should_not complain(verbose: false) end diff --git a/spec/ruby/library/stringscanner/peep_spec.rb b/spec/ruby/library/stringscanner/peep_spec.rb index a1c8565579..bf6d579325 100644 --- a/spec/ruby/library/stringscanner/peep_spec.rb +++ b/spec/ruby/library/stringscanner/peep_spec.rb @@ -7,11 +7,11 @@ describe "StringScanner#peep" do it "warns in verbose mode that the method is obsolete" do s = StringScanner.new("abc") - lambda { + -> { s.peep(1) }.should complain(/peep.*obsolete.*peek/, verbose: true) - lambda { + -> { s.peep(1) }.should_not complain(verbose: false) end diff --git a/spec/ruby/library/stringscanner/restsize_spec.rb b/spec/ruby/library/stringscanner/restsize_spec.rb index cf3e22f34c..710520afae 100644 --- a/spec/ruby/library/stringscanner/restsize_spec.rb +++ b/spec/ruby/library/stringscanner/restsize_spec.rb @@ -7,11 +7,11 @@ describe "StringScanner#restsize" do it "warns in verbose mode that the method is obsolete" do s = StringScanner.new("abc") - lambda { + -> { s.restsize }.should complain(/restsize.*obsolete.*rest_size/, verbose: true) - lambda { + -> { s.restsize }.should_not complain(verbose: false) end diff --git a/spec/ruby/library/stringscanner/scan_spec.rb b/spec/ruby/library/stringscanner/scan_spec.rb index 8e26b80591..8b9960e6e6 100644 --- a/spec/ruby/library/stringscanner/scan_spec.rb +++ b/spec/ruby/library/stringscanner/scan_spec.rb @@ -51,9 +51,9 @@ describe "StringScanner#scan" do end it "raises a TypeError if pattern isn't a Regexp" do - lambda { @s.scan("aoeu") }.should raise_error(TypeError) - lambda { @s.scan(5) }.should raise_error(TypeError) - lambda { @s.scan(:test) }.should raise_error(TypeError) - lambda { @s.scan(mock('x')) }.should raise_error(TypeError) + -> { @s.scan("aoeu") }.should raise_error(TypeError) + -> { @s.scan(5) }.should raise_error(TypeError) + -> { @s.scan(:test) }.should raise_error(TypeError) + -> { @s.scan(mock('x')) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/stringscanner/shared/concat.rb b/spec/ruby/library/stringscanner/shared/concat.rb index 214455d1b9..cb884a5c01 100644 --- a/spec/ruby/library/stringscanner/shared/concat.rb +++ b/spec/ruby/library/stringscanner/shared/concat.rb @@ -7,24 +7,24 @@ describe :strscan_concat, shared: true do end it "raises a TypeError if the given argument can't be converted to a String" do - lambda { StringScanner.new('hello').send(@method, :world) }.should raise_error(TypeError) - lambda { StringScanner.new('hello').send(@method, mock('x')) }.should raise_error(TypeError) + -> { StringScanner.new('hello').send(@method, :world) }.should raise_error(TypeError) + -> { StringScanner.new('hello').send(@method, mock('x')) }.should raise_error(TypeError) end end describe :strscan_concat_fixnum, shared: true do it "raises a TypeError" do a = StringScanner.new("hello world") - lambda { a.send(@method, 333) }.should raise_error(TypeError) + -> { a.send(@method, 333) }.should raise_error(TypeError) b = StringScanner.new("") - lambda { b.send(@method, (256 * 3 + 64)) }.should raise_error(TypeError) - lambda { b.send(@method, -200) }.should raise_error(TypeError) + -> { b.send(@method, (256 * 3 + 64)) }.should raise_error(TypeError) + -> { b.send(@method, -200) }.should raise_error(TypeError) end it "doesn't call to_int on the argument" do x = mock('x') x.should_not_receive(:to_int) - lambda { StringScanner.new("").send(@method, x) }.should raise_error(TypeError) + -> { StringScanner.new("").send(@method, x) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/stringscanner/shared/peek.rb b/spec/ruby/library/stringscanner/shared/peek.rb index 418ebb6536..a59afdc6c0 100644 --- a/spec/ruby/library/stringscanner/shared/peek.rb +++ b/spec/ruby/library/stringscanner/shared/peek.rb @@ -19,11 +19,11 @@ describe :strscan_peek, shared: true do end it "raises a ArgumentError when the passed argument is negative" do - lambda { @s.send(@method, -2) }.should raise_error(ArgumentError) + -> { @s.send(@method, -2) }.should raise_error(ArgumentError) end it "raises a RangeError when the passed argument is a Bignum" do - lambda { @s.send(@method, bignum_value) }.should raise_error(RangeError) + -> { @s.send(@method, bignum_value) }.should raise_error(RangeError) end it "returns an instance of String when passed a String subclass" do diff --git a/spec/ruby/library/stringscanner/shared/pos.rb b/spec/ruby/library/stringscanner/shared/pos.rb index 80ded17b0f..6d540881f2 100644 --- a/spec/ruby/library/stringscanner/shared/pos.rb +++ b/spec/ruby/library/stringscanner/shared/pos.rb @@ -41,12 +41,12 @@ describe :strscan_pos_set, shared: true do end it "raises a RangeError if position too far backward" do - lambda { + -> { @s.send(@method, -20) }.should raise_error(RangeError) end it "raises a RangeError when the passed argument is out of range" do - lambda { @s.send(@method, 20) }.should raise_error(RangeError) + -> { @s.send(@method, 20) }.should raise_error(RangeError) end end diff --git a/spec/ruby/library/stringscanner/unscan_spec.rb b/spec/ruby/library/stringscanner/unscan_spec.rb index ea5e6f4ef4..df0ea43367 100644 --- a/spec/ruby/library/stringscanner/unscan_spec.rb +++ b/spec/ruby/library/stringscanner/unscan_spec.rb @@ -22,7 +22,7 @@ describe "StringScanner#unscan" do end it "raises a ScanError when the previous match had failed" do - lambda { @s.unscan }.should raise_error(ScanError) - lambda { @s.scan(/\d/); @s.unscan }.should raise_error(ScanError) + -> { @s.unscan }.should raise_error(ScanError) + -> { @s.scan(/\d/); @s.unscan }.should raise_error(ScanError) end end diff --git a/spec/ruby/library/syslog/close_spec.rb b/spec/ruby/library/syslog/close_spec.rb index b1591045e3..8186ecf125 100644 --- a/spec/ruby/library/syslog/close_spec.rb +++ b/spec/ruby/library/syslog/close_spec.rb @@ -23,11 +23,11 @@ platform_is_not :windows do end it "raises a RuntimeError if the log's already closed" do - lambda { Syslog.close }.should raise_error(RuntimeError) + -> { Syslog.close }.should raise_error(RuntimeError) end it "it does not work inside blocks" do - lambda { + -> { Syslog.open { |s| s.close } }.should raise_error(RuntimeError) Syslog.opened?.should == false diff --git a/spec/ruby/library/syslog/log_spec.rb b/spec/ruby/library/syslog/log_spec.rb index 727fffbadf..ee62d484ac 100644 --- a/spec/ruby/library/syslog/log_spec.rb +++ b/spec/ruby/library/syslog/log_spec.rb @@ -15,7 +15,7 @@ platform_is_not :windows do end it "receives a priority as first argument" do - lambda { + -> { Syslog.open("rubyspec", Syslog::LOG_PERROR) do |s| s.log(Syslog::LOG_ALERT, "Hello") s.log(Syslog::LOG_CRIT, "World") @@ -24,7 +24,7 @@ platform_is_not :windows do end it "accepts undefined priorities" do - lambda { + -> { Syslog.open("rubyspec", Syslog::LOG_PERROR) do |s| s.log(1337, "Hello") end @@ -34,18 +34,18 @@ platform_is_not :windows do it "fails with TypeError on nil log messages" do Syslog.open do |s| - lambda { s.log(1, nil) }.should raise_error(TypeError) + -> { s.log(1, nil) }.should raise_error(TypeError) end end it "fails if the log is closed" do - lambda { + -> { Syslog.log(Syslog::LOG_ALERT, "test") }.should raise_error(RuntimeError) end it "accepts printf parameters" do - lambda { + -> { Syslog.open("rubyspec", Syslog::LOG_PERROR) do |s| s.log(Syslog::LOG_ALERT, "%s x %d", "chunky bacon", 2) end diff --git a/spec/ruby/library/syslog/mask_spec.rb b/spec/ruby/library/syslog/mask_spec.rb index 8caa5e69b8..6581f6a756 100644 --- a/spec/ruby/library/syslog/mask_spec.rb +++ b/spec/ruby/library/syslog/mask_spec.rb @@ -91,7 +91,7 @@ platform_is_not :windows do end it "raises an error if the log is closed" do - lambda { Syslog.mask = 1337 }.should raise_error(RuntimeError) + -> { Syslog.mask = 1337 }.should raise_error(RuntimeError) end it "only accepts numbers" do @@ -103,8 +103,8 @@ platform_is_not :windows do Syslog.mask = 3.1416 Syslog.mask.should == 3 - lambda { Syslog.mask = "oh hai" }.should raise_error(TypeError) - lambda { Syslog.mask = "43" }.should raise_error(TypeError) + -> { Syslog.mask = "oh hai" }.should raise_error(TypeError) + -> { Syslog.mask = "43" }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/syslog/open_spec.rb b/spec/ruby/library/syslog/open_spec.rb index 641d0979cd..543f5d418b 100644 --- a/spec/ruby/library/syslog/open_spec.rb +++ b/spec/ruby/library/syslog/open_spec.rb @@ -74,10 +74,10 @@ platform_is_not :windows do it "raises an error if the log is opened" do Syslog.open - lambda { + -> { Syslog.open }.should raise_error(RuntimeError, /syslog already open/) - lambda { + -> { Syslog.close Syslog.open }.should_not raise_error diff --git a/spec/ruby/library/syslog/shared/log.rb b/spec/ruby/library/syslog/shared/log.rb index 6d0d3a3c23..b19c2eae0d 100644 --- a/spec/ruby/library/syslog/shared/log.rb +++ b/spec/ruby/library/syslog/shared/log.rb @@ -9,7 +9,7 @@ describe :syslog_log, shared: true do end it "logs a message" do - lambda { + -> { Syslog.open("rubyspec", Syslog::LOG_PERROR) do Syslog.send(@method, "Hello") end @@ -17,7 +17,7 @@ describe :syslog_log, shared: true do end it "accepts sprintf arguments" do - lambda { + -> { Syslog.open("rubyspec", Syslog::LOG_PERROR) do Syslog.send(@method, "Hello %s", "world") Syslog.send(@method, "%d dogs", 2) @@ -28,7 +28,7 @@ describe :syslog_log, shared: true do it "works as an alias for Syslog.log" do level = Syslog.const_get "LOG_#{@method.to_s.upcase}" response = "rubyspec: Hello\n" - lambda { + -> { Syslog.open("rubyspec", Syslog::LOG_PERROR) do Syslog.send(@method, "Hello") Syslog.log(level, "Hello") diff --git a/spec/ruby/library/syslog/shared/reopen.rb b/spec/ruby/library/syslog/shared/reopen.rb index fd30ab824a..621437a01d 100644 --- a/spec/ruby/library/syslog/shared/reopen.rb +++ b/spec/ruby/library/syslog/shared/reopen.rb @@ -10,13 +10,13 @@ describe :syslog_reopen, shared: true do it "reopens the log" do Syslog.open - lambda { Syslog.send(@method)}.should_not raise_error + -> { Syslog.send(@method)}.should_not raise_error Syslog.opened?.should be_true Syslog.close end it "fails with RuntimeError if the log is closed" do - lambda { Syslog.send(@method)}.should raise_error(RuntimeError) + -> { Syslog.send(@method)}.should raise_error(RuntimeError) end it "receives the same parameters as Syslog.open" do diff --git a/spec/ruby/library/tempfile/initialize_spec.rb b/spec/ruby/library/tempfile/initialize_spec.rb index ad3c2f6437..3b20e8ad4b 100644 --- a/spec/ruby/library/tempfile/initialize_spec.rb +++ b/spec/ruby/library/tempfile/initialize_spec.rb @@ -38,4 +38,9 @@ describe "Tempfile#initialize" do @tempfile.send(:initialize, ['shiftjis', 'yml'], encoding: 'SHIFT_JIS') @tempfile.external_encoding.should == Encoding::Shift_JIS end + + it "does not try to modify the arguments" do + @tempfile.send(:initialize, ['frozen'.freeze, 'txt'.freeze], encoding: Encoding::IBM437) + @tempfile.external_encoding.should == Encoding::IBM437 + end end diff --git a/spec/ruby/library/time/shared/rfc2822.rb b/spec/ruby/library/time/shared/rfc2822.rb index b7bf0fb5f5..d99f1f76de 100644 --- a/spec/ruby/library/time/shared/rfc2822.rb +++ b/spec/ruby/library/time/shared/rfc2822.rb @@ -57,7 +57,7 @@ describe :time_rfc2822, shared: true do t18 = Time.rfc2822("Fri, 21 Nov 1997 09 : 55 : 06 -0600") t17.should == t18 - lambda { + -> { # inner comment is not supported. Time.rfc2822("Fri, 21 Nov 1997 09(comment): 55 : 06 -0600") }.should raise_error(ArgumentError) diff --git a/spec/ruby/library/timeout/timeout_spec.rb b/spec/ruby/library/timeout/timeout_spec.rb index fc957dc36f..a9a60fdeb9 100644 --- a/spec/ruby/library/timeout/timeout_spec.rb +++ b/spec/ruby/library/timeout/timeout_spec.rb @@ -3,7 +3,7 @@ require 'timeout' describe "Timeout.timeout" do it "raises Timeout::Error when it times out with no specified error type" do - lambda { + -> { Timeout.timeout(1) do sleep end @@ -11,7 +11,7 @@ describe "Timeout.timeout" do end it "raises specified error type when it times out" do - lambda do + -> do Timeout.timeout(1, StandardError) do sleep end diff --git a/spec/ruby/library/tmpdir/dir/mktmpdir_spec.rb b/spec/ruby/library/tmpdir/dir/mktmpdir_spec.rb index a619f386a6..eab86818bd 100644 --- a/spec/ruby/library/tmpdir/dir/mktmpdir_spec.rb +++ b/spec/ruby/library/tmpdir/dir/mktmpdir_spec.rb @@ -110,8 +110,8 @@ end describe "Dir.mktmpdir when passed [Object]" do it "raises an ArgumentError" do - lambda { Dir.mktmpdir(Object.new) }.should raise_error(ArgumentError) - lambda { Dir.mktmpdir(:symbol) }.should raise_error(ArgumentError) - lambda { Dir.mktmpdir(10) }.should raise_error(ArgumentError) + -> { Dir.mktmpdir(Object.new) }.should raise_error(ArgumentError) + -> { Dir.mktmpdir(:symbol) }.should raise_error(ArgumentError) + -> { Dir.mktmpdir(10) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/uri/join_spec.rb b/spec/ruby/library/uri/join_spec.rb index 6033ecf44c..796f74134f 100644 --- a/spec/ruby/library/uri/join_spec.rb +++ b/spec/ruby/library/uri/join_spec.rb @@ -21,7 +21,7 @@ describe "URI.join" do end it "raises an error if given no argument" do - lambda { + -> { URI.join }.should raise_error(ArgumentError) end diff --git a/spec/ruby/library/uri/mailto/build_spec.rb b/spec/ruby/library/uri/mailto/build_spec.rb index ca3b270c2c..2c011626ab 100644 --- a/spec/ruby/library/uri/mailto/build_spec.rb +++ b/spec/ruby/library/uri/mailto/build_spec.rb @@ -84,7 +84,7 @@ describe "URI::Mailto.build" do end bad.each do |x| - lambda { URI::MailTo.build(x) }.should raise_error(URI::InvalidComponentError) + -> { URI::MailTo.build(x) }.should raise_error(URI::InvalidComponentError) end ok.flatten.join("\0").should == ok_all diff --git a/spec/ruby/library/uri/plus_spec.rb b/spec/ruby/library/uri/plus_spec.rb index 4aede12216..b84b0767c1 100644 --- a/spec/ruby/library/uri/plus_spec.rb +++ b/spec/ruby/library/uri/plus_spec.rb @@ -36,7 +36,7 @@ describe "URI#+" do end it "raises a URI::BadURIError when adding two relative URIs" do - lambda {URI.parse('a/b/c') + "d"}.should raise_error(URI::BadURIError) + -> {URI.parse('a/b/c') + "d"}.should raise_error(URI::BadURIError) end #Todo: make more BDD? diff --git a/spec/ruby/library/uri/select_spec.rb b/spec/ruby/library/uri/select_spec.rb index 6e8c68cf40..c2eb6f8733 100644 --- a/spec/ruby/library/uri/select_spec.rb +++ b/spec/ruby/library/uri/select_spec.rb @@ -16,15 +16,15 @@ describe "URI#select" do it "raises an ArgumentError if a component is requested that isn't valid under the given scheme" do [ - lambda {URI("mailto:spam@mailinator.com").select(:path)}, - lambda {URI("http://blog.blag.web").select(:typecode)}, + -> {URI("mailto:spam@mailinator.com").select(:path)}, + -> {URI("http://blog.blag.web").select(:typecode)}, ].each do |select_lambda| select_lambda.should raise_error(ArgumentError) end end it "raises an ArgumentError if given strings rather than symbols" do - lambda { + -> { URI("http://host:8080/path/").select("scheme","host","port",'path') }.should raise_error(ArgumentError) end diff --git a/spec/ruby/library/uri/set_component_spec.rb b/spec/ruby/library/uri/set_component_spec.rb index 71ed6af278..642a5d6fcf 100644 --- a/spec/ruby/library/uri/set_component_spec.rb +++ b/spec/ruby/library/uri/set_component_spec.rb @@ -27,19 +27,19 @@ describe "URI#select" do uri.to_s.should == 'http://foo:bar@zab:8080/?a=1#b123' uri = URI.parse('http://example.com') - lambda { uri.password = 'bar' }.should raise_error(URI::InvalidURIError) + -> { uri.password = 'bar' }.should raise_error(URI::InvalidURIError) uri.userinfo = 'foo:bar' uri.to_s.should == 'http://foo:bar@example.com' - lambda { uri.registry = 'bar' }.should raise_error(URI::InvalidURIError) - lambda { uri.opaque = 'bar' }.should raise_error(URI::InvalidURIError) + -> { uri.registry = 'bar' }.should raise_error(URI::InvalidURIError) + -> { uri.opaque = 'bar' }.should raise_error(URI::InvalidURIError) uri = URI.parse('mailto:foo@example.com') - lambda { uri.user = 'bar' }.should raise_error(URI::InvalidURIError) - lambda { uri.password = 'bar' }.should raise_error(URI::InvalidURIError) - lambda { uri.userinfo = ['bar', 'baz'] }.should raise_error(URI::InvalidURIError) - lambda { uri.host = 'bar' }.should raise_error(URI::InvalidURIError) - lambda { uri.port = 'bar' }.should raise_error(URI::InvalidURIError) - lambda { uri.path = 'bar' }.should raise_error(URI::InvalidURIError) - lambda { uri.query = 'bar' }.should raise_error(URI::InvalidURIError) + -> { uri.user = 'bar' }.should raise_error(URI::InvalidURIError) + -> { uri.password = 'bar' }.should raise_error(URI::InvalidURIError) + -> { uri.userinfo = ['bar', 'baz'] }.should raise_error(URI::InvalidURIError) + -> { uri.host = 'bar' }.should raise_error(URI::InvalidURIError) + -> { uri.port = 'bar' }.should raise_error(URI::InvalidURIError) + -> { uri.path = 'bar' }.should raise_error(URI::InvalidURIError) + -> { uri.query = 'bar' }.should raise_error(URI::InvalidURIError) end end diff --git a/spec/ruby/library/uri/shared/join.rb b/spec/ruby/library/uri/shared/join.rb index ff85b57a80..4df0782b37 100644 --- a/spec/ruby/library/uri/shared/join.rb +++ b/spec/ruby/library/uri/shared/join.rb @@ -18,7 +18,7 @@ describe :uri_join, shared: true do end it "raises an error if given no argument" do - lambda { + -> { @object.join }.should raise_error(ArgumentError) end diff --git a/spec/ruby/library/uri/shared/parse.rb b/spec/ruby/library/uri/shared/parse.rb index 5ecbffcaf2..87e1ee933e 100644 --- a/spec/ruby/library/uri/shared/parse.rb +++ b/spec/ruby/library/uri/shared/parse.rb @@ -193,7 +193,7 @@ describe :uri_parse, shared: true do end it "raises errors on malformed URIs" do - lambda { @object.parse('http://a_b:80/') }.should raise_error(URI::InvalidURIError) - lambda { @object.parse('http://a_b/') }.should raise_error(URI::InvalidURIError) + -> { @object.parse('http://a_b:80/') }.should raise_error(URI::InvalidURIError) + -> { @object.parse('http://a_b/') }.should raise_error(URI::InvalidURIError) end end diff --git a/spec/ruby/library/uri/uri_spec.rb b/spec/ruby/library/uri/uri_spec.rb index 93ba07a207..45a7502052 100644 --- a/spec/ruby/library/uri/uri_spec.rb +++ b/spec/ruby/library/uri/uri_spec.rb @@ -24,6 +24,6 @@ describe "the URI method" do #apparently this was a concern? imported from MRI tests it "does not add a URI method to Object instances" do - lambda {Object.new.URI("http://ruby-lang.org/")}.should raise_error(NoMethodError) + -> {Object.new.URI("http://ruby-lang.org/")}.should raise_error(NoMethodError) end end diff --git a/spec/ruby/library/weakref/__getobj___spec.rb b/spec/ruby/library/weakref/__getobj___spec.rb index 4ed0bc6afb..79b06f5c96 100644 --- a/spec/ruby/library/weakref/__getobj___spec.rb +++ b/spec/ruby/library/weakref/__getobj___spec.rb @@ -10,7 +10,7 @@ describe "WeakRef#__getobj__" do it "raises WeakRef::RefError if the object is no longer reachable" do ref = WeakRefSpec.make_dead_weakref - lambda { + -> { ref.__getobj__ }.should raise_error(WeakRef::RefError) end diff --git a/spec/ruby/library/weakref/allocate_spec.rb b/spec/ruby/library/weakref/allocate_spec.rb index 76e81c4e5e..e734cfd23d 100644 --- a/spec/ruby/library/weakref/allocate_spec.rb +++ b/spec/ruby/library/weakref/allocate_spec.rb @@ -3,6 +3,6 @@ require 'weakref' describe "WeakRef#allocate" do it "assigns nil as the reference" do - lambda { WeakRef.allocate.__getobj__ }.should raise_error(WeakRef::RefError) + -> { WeakRef.allocate.__getobj__ }.should raise_error(WeakRef::RefError) end end diff --git a/spec/ruby/library/weakref/send_spec.rb b/spec/ruby/library/weakref/send_spec.rb index 079958ac88..9591657e01 100644 --- a/spec/ruby/library/weakref/send_spec.rb +++ b/spec/ruby/library/weakref/send_spec.rb @@ -27,11 +27,11 @@ describe "WeakRef#__send__" do it "delegates to protected methods of the weakly-referenced object" do wr = WeakRef.new(WeakRefSpecs) - lambda { wr.protected_method }.should raise_error(NameError) + -> { wr.protected_method }.should raise_error(NameError) end it "does not delegate to private methods of the weakly-referenced object" do wr = WeakRef.new(WeakRefSpecs) - lambda { wr.private_method }.should raise_error(NameError) + -> { wr.private_method }.should raise_error(NameError) end end diff --git a/spec/ruby/library/win32ole/win32ole/_invoke_spec.rb b/spec/ruby/library/win32ole/win32ole/_invoke_spec.rb index 9809f89e7c..91f5091d24 100644 --- a/spec/ruby/library/win32ole/win32ole/_invoke_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/_invoke_spec.rb @@ -7,9 +7,9 @@ platform_is :windows do end it "raises ArgumentError if insufficient number of arguments are given" do - lambda { @shell._invoke() }.should raise_error ArgumentError - lambda { @shell._invoke(0) }.should raise_error ArgumentError - lambda { @shell._invoke(0, []) }.should raise_error ArgumentError + -> { @shell._invoke() }.should raise_error ArgumentError + -> { @shell._invoke(0) }.should raise_error ArgumentError + -> { @shell._invoke(0, []) }.should raise_error ArgumentError end it "dispatches the method bound to a specific ID" do diff --git a/spec/ruby/library/win32ole/win32ole/connect_spec.rb b/spec/ruby/library/win32ole/win32ole/connect_spec.rb index 590ef7688c..72dceb1572 100644 --- a/spec/ruby/library/win32ole/win32ole/connect_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/connect_spec.rb @@ -8,7 +8,7 @@ platform_is :windows do end it "raises TypeError when given invalid argument" do - lambda { WIN32OLE.connect 1 }.should raise_error TypeError + -> { WIN32OLE.connect 1 }.should raise_error TypeError end end diff --git a/spec/ruby/library/win32ole/win32ole/locale_spec.rb b/spec/ruby/library/win32ole/win32ole/locale_spec.rb index a0376ce123..75a82ddd7f 100644 --- a/spec/ruby/library/win32ole/win32ole/locale_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/locale_spec.rb @@ -19,7 +19,7 @@ platform_is :windows do WIN32OLE.locale.should == 1041 WIN32OLE.locale = WIN32OLE::LOCALE_SYSTEM_DEFAULT - lambda { WIN32OLE.locale = 111 }.should raise_error WIN32OLERuntimeError + -> { WIN32OLE.locale = 111 }.should raise_error WIN32OLERuntimeError WIN32OLE.locale.should == WIN32OLE::LOCALE_SYSTEM_DEFAULT ensure WIN32OLE.locale.should == WIN32OLE::LOCALE_SYSTEM_DEFAULT diff --git a/spec/ruby/library/win32ole/win32ole/new_spec.rb b/spec/ruby/library/win32ole/win32ole/new_spec.rb index d1c3e02593..6b717195f1 100644 --- a/spec/ruby/library/win32ole/win32ole/new_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/new_spec.rb @@ -13,11 +13,11 @@ platform_is :windows do end it "raises TypeError if argument cannot be converted to String" do - lambda { WIN32OLESpecs.new_ole(42) }.should raise_error( TypeError ) + -> { WIN32OLESpecs.new_ole(42) }.should raise_error( TypeError ) end it "raises WIN32OLERuntimeError if invalid string is given" do - lambda { WIN32OLE.new('foo') }.should raise_error( WIN32OLERuntimeError ) + -> { WIN32OLE.new('foo') }.should raise_error( WIN32OLERuntimeError ) end end diff --git a/spec/ruby/library/win32ole/win32ole/ole_func_methods_spec.rb b/spec/ruby/library/win32ole/win32ole/ole_func_methods_spec.rb index 5488c4fd29..75748182fe 100644 --- a/spec/ruby/library/win32ole/win32ole/ole_func_methods_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/ole_func_methods_spec.rb @@ -7,7 +7,7 @@ platform_is :windows do end it "raises ArgumentError if argument is given" do - lambda { @dict.ole_func_methods(1) }.should raise_error ArgumentError + -> { @dict.ole_func_methods(1) }.should raise_error ArgumentError end it "returns an array of WIN32OLE_METHODs" do diff --git a/spec/ruby/library/win32ole/win32ole/ole_methods_spec.rb b/spec/ruby/library/win32ole/win32ole/ole_methods_spec.rb index b2baac265e..5ac9ae9cfa 100644 --- a/spec/ruby/library/win32ole/win32ole/ole_methods_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/ole_methods_spec.rb @@ -7,7 +7,7 @@ platform_is :windows do end it "raises ArgumentError if argument is given" do - lambda { @dict.ole_methods(1) }.should raise_error ArgumentError + -> { @dict.ole_methods(1) }.should raise_error ArgumentError end it "returns an array of WIN32OLE_METHODs" do diff --git a/spec/ruby/library/win32ole/win32ole/ole_obj_help_spec.rb b/spec/ruby/library/win32ole/win32ole/ole_obj_help_spec.rb index 2d31aac9eb..ef8944ee39 100644 --- a/spec/ruby/library/win32ole/win32ole/ole_obj_help_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/ole_obj_help_spec.rb @@ -8,7 +8,7 @@ platform_is :windows do end it "raises ArgumentError if argument is given" do - lambda { @dict.ole_obj_help(1) }.should raise_error ArgumentError + -> { @dict.ole_obj_help(1) }.should raise_error ArgumentError end it "returns an instance of WIN32OLE_TYPE" do diff --git a/spec/ruby/library/win32ole/win32ole/ole_put_methods_spec.rb b/spec/ruby/library/win32ole/win32ole/ole_put_methods_spec.rb index 45af41c6c2..727291e9f0 100644 --- a/spec/ruby/library/win32ole/win32ole/ole_put_methods_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/ole_put_methods_spec.rb @@ -7,7 +7,7 @@ platform_is :windows do end it "raises ArgumentError if argument is given" do - lambda { @dict.ole_put_methods(1) }.should raise_error ArgumentError + -> { @dict.ole_put_methods(1) }.should raise_error ArgumentError end it "returns an array of WIN32OLE_METHODs" do diff --git a/spec/ruby/library/win32ole/win32ole/shared/ole_method.rb b/spec/ruby/library/win32ole/win32ole/shared/ole_method.rb index 26566a0b14..f1fd8713a4 100644 --- a/spec/ruby/library/win32ole/win32ole/shared/ole_method.rb +++ b/spec/ruby/library/win32ole/win32ole/shared/ole_method.rb @@ -7,7 +7,7 @@ platform_is :windows do end it "raises ArgumentError if no argument is given" do - lambda { @dict.send(@method) }.should raise_error ArgumentError + -> { @dict.send(@method) }.should raise_error ArgumentError end it "returns the WIN32OLE_METHOD 'Add' if given 'Add'" do diff --git a/spec/ruby/library/win32ole/win32ole/shared/setproperty.rb b/spec/ruby/library/win32ole/win32ole/shared/setproperty.rb index b850d21933..b9267aef71 100644 --- a/spec/ruby/library/win32ole/win32ole/shared/setproperty.rb +++ b/spec/ruby/library/win32ole/win32ole/shared/setproperty.rb @@ -7,7 +7,7 @@ platform_is :windows do end it "raises ArgumentError if no argument is given" do - lambda { @dict.send(@method) }.should raise_error ArgumentError + -> { @dict.send(@method) }.should raise_error ArgumentError end it "sets key to newkey and returns nil" do diff --git a/spec/ruby/library/win32ole/win32ole_event/new_spec.rb b/spec/ruby/library/win32ole/win32ole_event/new_spec.rb index 4ce11a716b..a1a1612393 100644 --- a/spec/ruby/library/win32ole/win32ole_event/new_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_event/new_spec.rb @@ -12,16 +12,16 @@ platform_is :windows do end it "raises TypeError given invalid argument" do - lambda { WIN32OLE_EVENT.new "A" }.should raise_error TypeError + -> { WIN32OLE_EVENT.new "A" }.should raise_error TypeError end it "raises RuntimeError if event does not exist" do - lambda { WIN32OLE_EVENT.new(@xml_dom, 'A') }.should raise_error RuntimeError + -> { WIN32OLE_EVENT.new(@xml_dom, 'A') }.should raise_error RuntimeError end it "raises RuntimeError if OLE object has no events" do dict = WIN32OLESpecs.new_ole('Scripting.Dictionary') - lambda { WIN32OLE_EVENT.new(dict) }.should raise_error RuntimeError + -> { WIN32OLE_EVENT.new(dict) }.should raise_error RuntimeError end it "creates WIN32OLE_EVENT object" do diff --git a/spec/ruby/library/win32ole/win32ole_method/dispid_spec.rb b/spec/ruby/library/win32ole/win32ole_method/dispid_spec.rb index 840cdf72b8..69068683b7 100644 --- a/spec/ruby/library/win32ole/win32ole_method/dispid_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/dispid_spec.rb @@ -8,7 +8,7 @@ platform_is :windows do end it "raises ArgumentError if argument is given" do - lambda { @m.dispid(0) }.should raise_error ArgumentError + -> { @m.dispid(0) }.should raise_error ArgumentError end it "returns expected dispatch ID for Shell's 'namespace' method" do diff --git a/spec/ruby/library/win32ole/win32ole_method/event_interface_spec.rb b/spec/ruby/library/win32ole/win32ole_method/event_interface_spec.rb index 1b88d80ff9..70c8b30cca 100644 --- a/spec/ruby/library/win32ole/win32ole_method/event_interface_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/event_interface_spec.rb @@ -11,7 +11,7 @@ platform_is :windows do end it "raises ArgumentError if argument is given" do - lambda { @on_dbl_click_method.event_interface(1) }.should raise_error ArgumentError + -> { @on_dbl_click_method.event_interface(1) }.should raise_error ArgumentError end it "returns expected string for System Monitor Control's 'OnDblClick' method" do diff --git a/spec/ruby/library/win32ole/win32ole_method/event_spec.rb b/spec/ruby/library/win32ole/win32ole_method/event_spec.rb index 81628805d0..c41f8fe99d 100644 --- a/spec/ruby/library/win32ole/win32ole_method/event_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/event_spec.rb @@ -9,7 +9,7 @@ platform_is :windows do end it "raises ArgumentError if argument is given" do - lambda { @on_dbl_click_method.event?(1) }.should raise_error ArgumentError + -> { @on_dbl_click_method.event?(1) }.should raise_error ArgumentError end it "returns true for System Monitor Control's 'OnDblClick' method" do diff --git a/spec/ruby/library/win32ole/win32ole_method/helpcontext_spec.rb b/spec/ruby/library/win32ole/win32ole_method/helpcontext_spec.rb index a0008fa7d5..21b3ae8bde 100644 --- a/spec/ruby/library/win32ole/win32ole_method/helpcontext_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/helpcontext_spec.rb @@ -10,7 +10,7 @@ platform_is :windows do end it "raises ArgumentError if argument is given" do - lambda { @get_file_version.helpcontext(1) }.should raise_error ArgumentError + -> { @get_file_version.helpcontext(1) }.should raise_error ArgumentError end it "returns expected value for FileSystemObject's 'GetFileVersion' method" do diff --git a/spec/ruby/library/win32ole/win32ole_method/helpfile_spec.rb b/spec/ruby/library/win32ole/win32ole_method/helpfile_spec.rb index 72cc4da16b..b6d0a19a37 100644 --- a/spec/ruby/library/win32ole/win32ole_method/helpfile_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/helpfile_spec.rb @@ -8,7 +8,7 @@ platform_is :windows do end it "raises ArgumentError if argument is given" do - lambda { @m_file_name.helpfile(1) }.should raise_error ArgumentError + -> { @m_file_name.helpfile(1) }.should raise_error ArgumentError end it "returns expected value for Scripting Runtime's 'File' method" do diff --git a/spec/ruby/library/win32ole/win32ole_method/helpstring_spec.rb b/spec/ruby/library/win32ole/win32ole_method/helpstring_spec.rb index 60105d0aa2..9f940fd4a0 100644 --- a/spec/ruby/library/win32ole/win32ole_method/helpstring_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/helpstring_spec.rb @@ -8,7 +8,7 @@ platform_is :windows do end it "raises ArgumentError if argument is given" do - lambda { @m_file_name.helpstring(1) }.should raise_error ArgumentError + -> { @m_file_name.helpstring(1) }.should raise_error ArgumentError end it "returns expected value for Scripting Runtime's 'File' method" do diff --git a/spec/ruby/library/win32ole/win32ole_method/invkind_spec.rb b/spec/ruby/library/win32ole/win32ole_method/invkind_spec.rb index cf0a74bbce..7fff479daf 100644 --- a/spec/ruby/library/win32ole/win32ole_method/invkind_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/invkind_spec.rb @@ -8,7 +8,7 @@ platform_is :windows do end it "raises ArgumentError if argument is given" do - lambda { @m_file_name.invkind(1) }.should raise_error ArgumentError + -> { @m_file_name.invkind(1) }.should raise_error ArgumentError end it "returns expected value for Scripting Runtime's 'name' method" do diff --git a/spec/ruby/library/win32ole/win32ole_method/invoke_kind_spec.rb b/spec/ruby/library/win32ole/win32ole_method/invoke_kind_spec.rb index 4d2af8fb0c..e8638abd91 100644 --- a/spec/ruby/library/win32ole/win32ole_method/invoke_kind_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/invoke_kind_spec.rb @@ -8,7 +8,7 @@ platform_is :windows do end it "raises ArgumentError if argument is given" do - lambda { @m_file_name.invoke_kind(1) }.should raise_error ArgumentError + -> { @m_file_name.invoke_kind(1) }.should raise_error ArgumentError end it "returns expected value for Scripting Runtime's 'name' method" do diff --git a/spec/ruby/library/win32ole/win32ole_method/new_spec.rb b/spec/ruby/library/win32ole/win32ole_method/new_spec.rb index f904107c6c..8ebf93b992 100644 --- a/spec/ruby/library/win32ole/win32ole_method/new_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/new_spec.rb @@ -7,12 +7,12 @@ platform_is :windows do end it "raises TypeError when given non-strings" do - lambda { WIN32OLE_METHOD.new(1, 2) }.should raise_error TypeError + -> { WIN32OLE_METHOD.new(1, 2) }.should raise_error TypeError end it "raises ArgumentError if only 1 argument is given" do - lambda { WIN32OLE_METHOD.new("hello") }.should raise_error ArgumentError - lambda { WIN32OLE_METHOD.new(@ole_type) }.should raise_error ArgumentError + -> { WIN32OLE_METHOD.new("hello") }.should raise_error ArgumentError + -> { WIN32OLE_METHOD.new(@ole_type) }.should raise_error ArgumentError end it "returns a valid WIN32OLE_METHOD object" do @@ -21,11 +21,11 @@ platform_is :windows do end it "raises WIN32OLERuntimeError if the method does not exist" do - lambda { WIN32OLE_METHOD.new(@ole_type, "NonexistentMethod") }.should raise_error WIN32OLERuntimeError + -> { WIN32OLE_METHOD.new(@ole_type, "NonexistentMethod") }.should raise_error WIN32OLERuntimeError end it "raises TypeError if second argument is not a String" do - lambda { WIN32OLE_METHOD.new(@ole_type, 5) }.should raise_error TypeError + -> { WIN32OLE_METHOD.new(@ole_type, 5) }.should raise_error TypeError end end diff --git a/spec/ruby/library/win32ole/win32ole_method/offset_vtbl_spec.rb b/spec/ruby/library/win32ole/win32ole_method/offset_vtbl_spec.rb index f94e48c051..8e50c39787 100644 --- a/spec/ruby/library/win32ole/win32ole_method/offset_vtbl_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/offset_vtbl_spec.rb @@ -8,7 +8,7 @@ platform_is :windows do end it "raises ArgumentError if argument is given" do - lambda { @m_file_name.offset_vtbl(1) }.should raise_error ArgumentError + -> { @m_file_name.offset_vtbl(1) }.should raise_error ArgumentError end it "returns expected value for Scripting Runtime's 'name' method" do diff --git a/spec/ruby/library/win32ole/win32ole_method/params_spec.rb b/spec/ruby/library/win32ole/win32ole_method/params_spec.rb index 08c7f04bdd..2f8da3d45b 100644 --- a/spec/ruby/library/win32ole/win32ole_method/params_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/params_spec.rb @@ -10,7 +10,7 @@ platform_is :windows do end it "raises ArgumentError if argument is given" do - lambda { @m_file_name.params(1) }.should raise_error ArgumentError + -> { @m_file_name.params(1) }.should raise_error ArgumentError end it "returns empty array for Scripting Runtime's 'name' method" do diff --git a/spec/ruby/library/win32ole/win32ole_method/return_type_detail_spec.rb b/spec/ruby/library/win32ole/win32ole_method/return_type_detail_spec.rb index b8f2bbe084..f8ce3e1b3a 100644 --- a/spec/ruby/library/win32ole/win32ole_method/return_type_detail_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/return_type_detail_spec.rb @@ -8,7 +8,7 @@ platform_is :windows do end it "raises ArgumentError if argument is given" do - lambda { @m_browse_for_folder.return_type_detail(1) }.should raise_error ArgumentError + -> { @m_browse_for_folder.return_type_detail(1) }.should raise_error ArgumentError end it "returns expected value for Shell Control's 'BrowseForFolder' method" do diff --git a/spec/ruby/library/win32ole/win32ole_method/return_type_spec.rb b/spec/ruby/library/win32ole/win32ole_method/return_type_spec.rb index b68481fe59..58e26df77b 100644 --- a/spec/ruby/library/win32ole/win32ole_method/return_type_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/return_type_spec.rb @@ -8,7 +8,7 @@ platform_is :windows do end it "raises ArgumentError if argument is given" do - lambda { @m_file_name.return_type(1) }.should raise_error ArgumentError + -> { @m_file_name.return_type(1) }.should raise_error ArgumentError end it "returns expected value for Scripting Runtime's 'name' method" do diff --git a/spec/ruby/library/win32ole/win32ole_method/return_vtype_spec.rb b/spec/ruby/library/win32ole/win32ole_method/return_vtype_spec.rb index f236de01f9..dc159dd09e 100644 --- a/spec/ruby/library/win32ole/win32ole_method/return_vtype_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/return_vtype_spec.rb @@ -8,7 +8,7 @@ platform_is :windows do end it "raises ArgumentError if argument is given" do - lambda { @m_browse_for_folder.return_vtype(1) }.should raise_error ArgumentError + -> { @m_browse_for_folder.return_vtype(1) }.should raise_error ArgumentError end it "returns expected value for Shell Control's 'BrowseForFolder' method" do diff --git a/spec/ruby/library/win32ole/win32ole_method/shared/name.rb b/spec/ruby/library/win32ole/win32ole_method/shared/name.rb index 2be6478a6e..ddaff4011b 100644 --- a/spec/ruby/library/win32ole/win32ole_method/shared/name.rb +++ b/spec/ruby/library/win32ole/win32ole_method/shared/name.rb @@ -8,7 +8,7 @@ platform_is :windows do end it "raises ArgumentError if argument is given" do - lambda { @m_file_name.send(@method, 1) }.should raise_error ArgumentError + -> { @m_file_name.send(@method, 1) }.should raise_error ArgumentError end it "returns expected value for Scripting Runtime's 'name' method" do diff --git a/spec/ruby/library/win32ole/win32ole_method/size_opt_params_spec.rb b/spec/ruby/library/win32ole/win32ole_method/size_opt_params_spec.rb index a63c50474c..a38fe5c681 100644 --- a/spec/ruby/library/win32ole/win32ole_method/size_opt_params_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/size_opt_params_spec.rb @@ -8,7 +8,7 @@ platform_is :windows do end it "raises ArgumentError if argument is given" do - lambda { @m_browse_for_folder.size_opt_params(1) }.should raise_error ArgumentError + -> { @m_browse_for_folder.size_opt_params(1) }.should raise_error ArgumentError end it "returns expected value for Shell Control's 'BrowseForFolder' method" do diff --git a/spec/ruby/library/win32ole/win32ole_method/size_params_spec.rb b/spec/ruby/library/win32ole/win32ole_method/size_params_spec.rb index fe93d5bc66..0c5a94c338 100644 --- a/spec/ruby/library/win32ole/win32ole_method/size_params_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/size_params_spec.rb @@ -8,7 +8,7 @@ platform_is :windows do end it "raises ArgumentError if argument is given" do - lambda { @m_browse_for_folder.size_params(1) }.should raise_error ArgumentError + -> { @m_browse_for_folder.size_params(1) }.should raise_error ArgumentError end it "returns expected value for Shell Control's 'BrowseForFolder' method" do diff --git a/spec/ruby/library/win32ole/win32ole_method/visible_spec.rb b/spec/ruby/library/win32ole/win32ole_method/visible_spec.rb index b49fac6066..918b6ef782 100644 --- a/spec/ruby/library/win32ole/win32ole_method/visible_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/visible_spec.rb @@ -8,7 +8,7 @@ platform_is :windows do end it "raises ArgumentError if argument is given" do - lambda { @m_browse_for_folder.visible?(1) }.should raise_error ArgumentError + -> { @m_browse_for_folder.visible?(1) }.should raise_error ArgumentError end it "returns true for Shell Control's 'BrowseForFolder' method" do diff --git a/spec/ruby/library/win32ole/win32ole_param/default_spec.rb b/spec/ruby/library/win32ole/win32ole_param/default_spec.rb index 7a1337ec7c..af08c84782 100644 --- a/spec/ruby/library/win32ole/win32ole_param/default_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_param/default_spec.rb @@ -13,7 +13,7 @@ platform_is :windows do end it "raises ArgumentError if argument is given" do - lambda { @params[0].default(1) }.should raise_error ArgumentError + -> { @params[0].default(1) }.should raise_error ArgumentError end it "returns nil for each of WIN32OLE_PARAM for Shell's 'BrowseForFolder' method" do diff --git a/spec/ruby/library/win32ole/win32ole_param/input_spec.rb b/spec/ruby/library/win32ole/win32ole_param/input_spec.rb index bdf4bccc79..a0022fef13 100644 --- a/spec/ruby/library/win32ole/win32ole_param/input_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_param/input_spec.rb @@ -9,7 +9,7 @@ platform_is :windows do end it "raises ArgumentError if argument is given" do - lambda { @param_overwritefiles.input?(1) }.should raise_error ArgumentError + -> { @param_overwritefiles.input?(1) }.should raise_error ArgumentError end it "returns true for 3rd parameter of FileSystemObject's 'CopyFile' method" do diff --git a/spec/ruby/library/win32ole/win32ole_param/ole_type_detail_spec.rb b/spec/ruby/library/win32ole/win32ole_param/ole_type_detail_spec.rb index 3ba51c02f1..e683d1c16e 100644 --- a/spec/ruby/library/win32ole/win32ole_param/ole_type_detail_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_param/ole_type_detail_spec.rb @@ -9,7 +9,7 @@ platform_is :windows do end it "raises ArgumentError if argument is given" do - lambda { @param_overwritefiles.ole_type_detail(1) }.should raise_error ArgumentError + -> { @param_overwritefiles.ole_type_detail(1) }.should raise_error ArgumentError end it "returns ['BOOL'] for 3rd parameter of FileSystemObject's 'CopyFile' method" do diff --git a/spec/ruby/library/win32ole/win32ole_param/ole_type_spec.rb b/spec/ruby/library/win32ole/win32ole_param/ole_type_spec.rb index 52bee2c9b8..b9a3639c3e 100644 --- a/spec/ruby/library/win32ole/win32ole_param/ole_type_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_param/ole_type_spec.rb @@ -9,7 +9,7 @@ platform_is :windows do end it "raises ArgumentError if argument is given" do - lambda { @param_overwritefiles.ole_type(1) }.should raise_error ArgumentError + -> { @param_overwritefiles.ole_type(1) }.should raise_error ArgumentError end it "returns 'BOOL' for 3rd parameter of FileSystemObject's 'CopyFile' method" do diff --git a/spec/ruby/library/win32ole/win32ole_param/optional_spec.rb b/spec/ruby/library/win32ole/win32ole_param/optional_spec.rb index 2476df8641..3fb9dc1867 100644 --- a/spec/ruby/library/win32ole/win32ole_param/optional_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_param/optional_spec.rb @@ -9,7 +9,7 @@ platform_is :windows do end it "raises ArgumentError if argument is given" do - lambda { @param_overwritefiles.optional?(1) }.should raise_error ArgumentError + -> { @param_overwritefiles.optional?(1) }.should raise_error ArgumentError end it "returns true for 3rd parameter of FileSystemObject's 'CopyFile' method" do diff --git a/spec/ruby/library/win32ole/win32ole_param/retval_spec.rb b/spec/ruby/library/win32ole/win32ole_param/retval_spec.rb index 90946c0774..f5546e79e5 100644 --- a/spec/ruby/library/win32ole/win32ole_param/retval_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_param/retval_spec.rb @@ -9,7 +9,7 @@ platform_is :windows do end it "raises ArgumentError if argument is given" do - lambda { @param_overwritefiles.retval?(1) }.should raise_error ArgumentError + -> { @param_overwritefiles.retval?(1) }.should raise_error ArgumentError end it "returns false for 3rd parameter of FileSystemObject's 'CopyFile' method" do diff --git a/spec/ruby/library/win32ole/win32ole_param/shared/name.rb b/spec/ruby/library/win32ole/win32ole_param/shared/name.rb index b7892d92fb..043bc32856 100644 --- a/spec/ruby/library/win32ole/win32ole_param/shared/name.rb +++ b/spec/ruby/library/win32ole/win32ole_param/shared/name.rb @@ -9,7 +9,7 @@ platform_is :windows do end it "raises ArgumentError if argument is given" do - lambda { @param_overwritefiles.send(@method, 1) }.should raise_error ArgumentError + -> { @param_overwritefiles.send(@method, 1) }.should raise_error ArgumentError end it "returns expected value for Scripting Runtime's 'name' method" do diff --git a/spec/ruby/library/win32ole/win32ole_type/new_spec.rb b/spec/ruby/library/win32ole/win32ole_type/new_spec.rb index 9443a64c75..fab690c2dd 100644 --- a/spec/ruby/library/win32ole/win32ole_type/new_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/new_spec.rb @@ -3,23 +3,23 @@ platform_is :windows do describe "WIN32OLE_TYPE.new" do it "raises ArgumentError with no argument" do - lambda { WIN32OLE_TYPE.new }.should raise_error ArgumentError + -> { WIN32OLE_TYPE.new }.should raise_error ArgumentError end it "raises ArgumentError with invalid string" do - lambda { WIN32OLE_TYPE.new("foo") }.should raise_error ArgumentError + -> { WIN32OLE_TYPE.new("foo") }.should raise_error ArgumentError end it "raises TypeError if second argument is not a String" do - lambda { WIN32OLE_TYPE.new(1,2) }.should raise_error TypeError - lambda { WIN32OLE_TYPE.new('Microsoft Shell Controls And Automation',2) }. + -> { WIN32OLE_TYPE.new(1,2) }.should raise_error TypeError + -> { WIN32OLE_TYPE.new('Microsoft Shell Controls And Automation',2) }. should raise_error TypeError end it "raise WIN32OLERuntimeError if OLE object specified is not found" do - lambda { WIN32OLE_TYPE.new('Microsoft Shell Controls And Automation','foo') }. + -> { WIN32OLE_TYPE.new('Microsoft Shell Controls And Automation','foo') }. should raise_error WIN32OLERuntimeError - lambda { WIN32OLE_TYPE.new('Microsoft Shell Controls And Automation','Application') }. + -> { WIN32OLE_TYPE.new('Microsoft Shell Controls And Automation','Application') }. should raise_error WIN32OLERuntimeError end diff --git a/spec/ruby/library/win32ole/win32ole_type/progids_spec.rb b/spec/ruby/library/win32ole/win32ole_type/progids_spec.rb index 0cdd3514e3..19d8bf56e0 100644 --- a/spec/ruby/library/win32ole/win32ole_type/progids_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/progids_spec.rb @@ -3,7 +3,7 @@ platform_is :windows do describe "WIN32OLE_TYPE.progids" do it "raises ArgumentError if an argument is given" do - lambda { WIN32OLE_TYPE.progids(1) }.should raise_error ArgumentError + -> { WIN32OLE_TYPE.progids(1) }.should raise_error ArgumentError end it "returns an array containing 'Shell.Explorer'" do diff --git a/spec/ruby/library/win32ole/win32ole_type/shared/name.rb b/spec/ruby/library/win32ole/win32ole_type/shared/name.rb index 6484ef0ef8..6f37446b23 100644 --- a/spec/ruby/library/win32ole/win32ole_type/shared/name.rb +++ b/spec/ruby/library/win32ole/win32ole_type/shared/name.rb @@ -7,7 +7,7 @@ platform_is :windows do end it "raises ArgumentError if argument is given" do - lambda { @ole_type.send(@method, 1) }.should raise_error ArgumentError + -> { @ole_type.send(@method, 1) }.should raise_error ArgumentError end it "returns a String" do diff --git a/spec/ruby/library/win32ole/win32ole_type/typelibs_spec.rb b/spec/ruby/library/win32ole/win32ole_type/typelibs_spec.rb index 3a28c0496c..369e0274f3 100644 --- a/spec/ruby/library/win32ole/win32ole_type/typelibs_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/typelibs_spec.rb @@ -11,7 +11,7 @@ platform_is :windows do end it "raises ArgumentError if any argument is give" do - lambda { WIN32OLE_TYPE.typelibs(1) }.should raise_error ArgumentError + -> { WIN32OLE_TYPE.typelibs(1) }.should raise_error ArgumentError end it "returns array of type libraries" do diff --git a/spec/ruby/library/yaml/load_spec.rb b/spec/ruby/library/yaml/load_spec.rb index 1e16bed4e6..0b6bef2dac 100644 --- a/spec/ruby/library/yaml/load_spec.rb +++ b/spec/ruby/library/yaml/load_spec.rb @@ -61,7 +61,7 @@ describe "YAML.load" do else error = ArgumentError end - lambda { YAML.load("key1: value\ninvalid_key") }.should raise_error(error) + -> { YAML.load("key1: value\ninvalid_key") }.should raise_error(error) end it "accepts symbols" do @@ -130,7 +130,7 @@ describe "YAML.load" do it "loads a File but raise an error when used as it is uninitialized" do loaded = YAML.load("--- !ruby/object:File {}\n") - lambda { + -> { loaded.read(1) }.should raise_error(IOError) end diff --git a/spec/ruby/library/zlib/adler32_spec.rb b/spec/ruby/library/zlib/adler32_spec.rb index 1da12aece0..62240e2de7 100644 --- a/spec/ruby/library/zlib/adler32_spec.rb +++ b/spec/ruby/library/zlib/adler32_spec.rb @@ -19,7 +19,7 @@ describe "Zlib.adler32" do Zlib.adler32(test_string, 1).should == 66391324 Zlib.adler32(test_string, 2**8).should == 701435419 Zlib.adler32(test_string, 2**16).should == 63966491 - lambda { Zlib.adler32(test_string, 2**128) }.should raise_error(RangeError) + -> { Zlib.adler32(test_string, 2**128) }.should raise_error(RangeError) end it "calculates the Adler checksum for string and initial Adler value for Bignums" do diff --git a/spec/ruby/library/zlib/crc32_spec.rb b/spec/ruby/library/zlib/crc32_spec.rb index 02f95fd92c..4c1d6ce2e9 100644 --- a/spec/ruby/library/zlib/crc32_spec.rb +++ b/spec/ruby/library/zlib/crc32_spec.rb @@ -26,7 +26,7 @@ describe "Zlib.crc32" do Zlib.crc32(test_string, 2**16).should == 1932511220 Zlib.crc32("p", ~305419896).should == 4046865307 Zlib.crc32("p", -305419897).should == 4046865307 - lambda { Zlib.crc32(test_string, 2**128) }.should raise_error(RangeError) + -> { Zlib.crc32(test_string, 2**128) }.should raise_error(RangeError) end it "calculates the CRC checksum for string and initial CRC value for Bignums" do diff --git a/spec/ruby/library/zlib/gzipfile/close_spec.rb b/spec/ruby/library/zlib/gzipfile/close_spec.rb index 27eb34cdd9..870870f2fa 100644 --- a/spec/ruby/library/zlib/gzipfile/close_spec.rb +++ b/spec/ruby/library/zlib/gzipfile/close_spec.rb @@ -10,9 +10,9 @@ describe "Zlib::GzipFile#close" do gzio.closed?.should == true - lambda { gzio.orig_name }.should \ + -> { gzio.orig_name }.should \ raise_error(Zlib::GzipFile::Error, 'closed gzip stream') - lambda { gzio.comment }.should \ + -> { gzio.comment }.should \ raise_error(Zlib::GzipFile::Error, 'closed gzip stream') end diff --git a/spec/ruby/library/zlib/gzipfile/comment_spec.rb b/spec/ruby/library/zlib/gzipfile/comment_spec.rb index 7493f74f1c..70d97ecaf6 100644 --- a/spec/ruby/library/zlib/gzipfile/comment_spec.rb +++ b/spec/ruby/library/zlib/gzipfile/comment_spec.rb @@ -19,7 +19,7 @@ describe "Zlib::GzipFile#comment" do Zlib::GzipWriter.wrap @io do |gzio| gzio.close - lambda { gzio.comment }.should \ + -> { gzio.comment }.should \ raise_error(Zlib::GzipFile::Error, 'closed gzip stream') end end diff --git a/spec/ruby/library/zlib/gzipfile/orig_name_spec.rb b/spec/ruby/library/zlib/gzipfile/orig_name_spec.rb index cae5305355..ebfd3692af 100644 --- a/spec/ruby/library/zlib/gzipfile/orig_name_spec.rb +++ b/spec/ruby/library/zlib/gzipfile/orig_name_spec.rb @@ -19,7 +19,7 @@ describe "Zlib::GzipFile#orig_name" do Zlib::GzipWriter.wrap @io do |gzio| gzio.close - lambda { gzio.orig_name }.should \ + -> { gzio.orig_name }.should \ raise_error(Zlib::GzipFile::Error, 'closed gzip stream') end end diff --git a/spec/ruby/library/zlib/gzipreader/read_spec.rb b/spec/ruby/library/zlib/gzipreader/read_spec.rb index 67672eb0b8..a13f087fe9 100644 --- a/spec/ruby/library/zlib/gzipreader/read_spec.rb +++ b/spec/ruby/library/zlib/gzipreader/read_spec.rb @@ -29,7 +29,7 @@ describe "GzipReader#read" do it "does not accept a negative length to read" do gz = Zlib::GzipReader.new @io - lambda { + -> { gz.read(-1) }.should raise_error(ArgumentError) end diff --git a/spec/ruby/library/zlib/gzipwriter/mtime_spec.rb b/spec/ruby/library/zlib/gzipwriter/mtime_spec.rb index 96e2b18368..621b602dc7 100644 --- a/spec/ruby/library/zlib/gzipwriter/mtime_spec.rb +++ b/spec/ruby/library/zlib/gzipwriter/mtime_spec.rb @@ -31,7 +31,7 @@ describe "Zlib::GzipWriter#mtime=" do Zlib::GzipWriter.wrap @io do |gzio| gzio.write '' - lambda { gzio.mtime = nil }.should \ + -> { gzio.mtime = nil }.should \ raise_error(Zlib::GzipFile::Error, 'header is already written') end end diff --git a/spec/ruby/library/zlib/inflate/append_spec.rb b/spec/ruby/library/zlib/inflate/append_spec.rb index e1c357f82e..f121e66566 100644 --- a/spec/ruby/library/zlib/inflate/append_spec.rb +++ b/spec/ruby/library/zlib/inflate/append_spec.rb @@ -41,7 +41,7 @@ describe "Zlib::Inflate#<<" do it "properly handles incomplete data" do # add bytes, one by one @foo_deflated[0, 5].each_byte { |d| @z << d.chr} - lambda { @z.finish }.should raise_error(Zlib::BufError) + -> { @z.finish }.should raise_error(Zlib::BufError) end it "properly handles excessive data, byte-by-byte" do diff --git a/spec/ruby/library/zlib/inflate/inflate_spec.rb b/spec/ruby/library/zlib/inflate/inflate_spec.rb index 7d66fb039a..cc33bd4c32 100644 --- a/spec/ruby/library/zlib/inflate/inflate_spec.rb +++ b/spec/ruby/library/zlib/inflate/inflate_spec.rb @@ -77,7 +77,7 @@ describe "Zlib::Inflate.inflate" do # add bytes, one by one, but not all result = "" data.each_byte { |d| result << z.inflate(d.chr)} - lambda { result << z.finish }.should raise_error(Zlib::BufError) + -> { result << z.finish }.should raise_error(Zlib::BufError) end it "properly handles excessive data, byte-by-byte" do |