diff options
Diffstat (limited to 'spec/ruby/core/complex')
-rw-r--r-- | spec/ruby/core/complex/coerce_spec.rb | 8 | ||||
-rw-r--r-- | spec/ruby/core/complex/fdiv_spec.rb | 18 | ||||
-rw-r--r-- | spec/ruby/core/complex/negative_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/complex/polar_spec.rb | 4 | ||||
-rw-r--r-- | spec/ruby/core/complex/positive_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/complex/rationalize_spec.rb | 8 | ||||
-rw-r--r-- | spec/ruby/core/complex/shared/divide.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/complex/shared/rect.rb | 10 | ||||
-rw-r--r-- | spec/ruby/core/complex/to_f_spec.rb | 4 | ||||
-rw-r--r-- | spec/ruby/core/complex/to_i_spec.rb | 4 | ||||
-rw-r--r-- | spec/ruby/core/complex/to_r_spec.rb | 4 |
11 files changed, 33 insertions, 33 deletions
diff --git a/spec/ruby/core/complex/coerce_spec.rb b/spec/ruby/core/complex/coerce_spec.rb index ce2fb36b73..a30a6c1d5f 100644 --- a/spec/ruby/core/complex/coerce_spec.rb +++ b/spec/ruby/core/complex/coerce_spec.rb @@ -53,18 +53,18 @@ describe "Complex#coerce" do it "raises TypeError when other is a Numeric which responds to #real? with false" do other = mock_numeric('other') other.should_receive(:real?).any_number_of_times.and_return(false) - lambda { @one.coerce(other) }.should raise_error(TypeError) + -> { @one.coerce(other) }.should raise_error(TypeError) end it "raises a TypeError when other is a String" do - lambda { @one.coerce("20") }.should raise_error(TypeError) + -> { @one.coerce("20") }.should raise_error(TypeError) end it "raises a TypeError when other is nil" do - lambda { @one.coerce(nil) }.should raise_error(TypeError) + -> { @one.coerce(nil) }.should raise_error(TypeError) end it "raises a TypeError when other is false" do - lambda { @one.coerce(false) }.should raise_error(TypeError) + -> { @one.coerce(false) }.should raise_error(TypeError) end end diff --git a/spec/ruby/core/complex/fdiv_spec.rb b/spec/ruby/core/complex/fdiv_spec.rb index 20d2f41354..68f7d1b309 100644 --- a/spec/ruby/core/complex/fdiv_spec.rb +++ b/spec/ruby/core/complex/fdiv_spec.rb @@ -2,21 +2,21 @@ require_relative '../../spec_helper' describe "Complex#fdiv" do it "accepts a numeric argument" do - lambda { Complex(20).fdiv(2) }.should_not raise_error(TypeError) - lambda { Complex(20).fdiv(2.0) }.should_not raise_error(TypeError) - lambda { Complex(20).fdiv(bignum_value) }.should_not raise_error(TypeError) + -> { Complex(20).fdiv(2) }.should_not raise_error(TypeError) + -> { Complex(20).fdiv(2.0) }.should_not raise_error(TypeError) + -> { Complex(20).fdiv(bignum_value) }.should_not raise_error(TypeError) end it "accepts a negative numeric argument" do - lambda { Complex(20).fdiv(-2) }.should_not raise_error(TypeError) - lambda { Complex(20).fdiv(-2.0) }.should_not raise_error(TypeError) - lambda { Complex(20).fdiv(-bignum_value) }.should_not raise_error(TypeError) + -> { Complex(20).fdiv(-2) }.should_not raise_error(TypeError) + -> { Complex(20).fdiv(-2.0) }.should_not raise_error(TypeError) + -> { Complex(20).fdiv(-bignum_value) }.should_not raise_error(TypeError) end it "raises a TypeError if passed a non-numeric argument" do - lambda { Complex(20).fdiv([]) }.should raise_error(TypeError) - lambda { Complex(20).fdiv(:sym) }.should raise_error(TypeError) - lambda { Complex(20).fdiv('s') }.should raise_error(TypeError) + -> { Complex(20).fdiv([]) }.should raise_error(TypeError) + -> { Complex(20).fdiv(:sym) }.should raise_error(TypeError) + -> { Complex(20).fdiv('s') }.should raise_error(TypeError) end it "sets the real part to NaN if self's real part is NaN" do diff --git a/spec/ruby/core/complex/negative_spec.rb b/spec/ruby/core/complex/negative_spec.rb index 1ea5392f39..62ab89c04a 100644 --- a/spec/ruby/core/complex/negative_spec.rb +++ b/spec/ruby/core/complex/negative_spec.rb @@ -6,7 +6,7 @@ describe "Complex#negative?" do c.methods.should_not include(:negative?) - lambda { + -> { c.negative? }.should raise_error(NoMethodError) end diff --git a/spec/ruby/core/complex/polar_spec.rb b/spec/ruby/core/complex/polar_spec.rb index f9d28b8388..2a5d8ebd69 100644 --- a/spec/ruby/core/complex/polar_spec.rb +++ b/spec/ruby/core/complex/polar_spec.rb @@ -7,8 +7,8 @@ describe "Complex.polar" do end it "raises a TypeError when given non real arguments" do - lambda{ Complex.polar(nil) }.should raise_error(TypeError) - lambda{ Complex.polar(nil, nil) }.should raise_error(TypeError) + ->{ Complex.polar(nil) }.should raise_error(TypeError) + ->{ Complex.polar(nil, nil) }.should raise_error(TypeError) end end diff --git a/spec/ruby/core/complex/positive_spec.rb b/spec/ruby/core/complex/positive_spec.rb index eea0af3755..f1bad8608c 100644 --- a/spec/ruby/core/complex/positive_spec.rb +++ b/spec/ruby/core/complex/positive_spec.rb @@ -6,7 +6,7 @@ describe "Complex#positive?" do c.methods.should_not include(:positive?) - lambda { + -> { c.positive? }.should raise_error(NoMethodError) end diff --git a/spec/ruby/core/complex/rationalize_spec.rb b/spec/ruby/core/complex/rationalize_spec.rb index 165f3d2700..043b8ddf2a 100644 --- a/spec/ruby/core/complex/rationalize_spec.rb +++ b/spec/ruby/core/complex/rationalize_spec.rb @@ -2,11 +2,11 @@ require_relative '../../spec_helper' describe "Complex#rationalize" do it "raises RangeError if self has non-zero imaginary part" do - lambda { Complex(1,5).rationalize }.should raise_error(RangeError) + -> { Complex(1,5).rationalize }.should raise_error(RangeError) end it "raises RangeError if self has 0.0 imaginary part" do - lambda { Complex(1,0.0).rationalize }.should raise_error(RangeError) + -> { Complex(1,0.0).rationalize }.should raise_error(RangeError) end it "returns a Rational if self has zero imaginary part" do @@ -25,7 +25,7 @@ describe "Complex#rationalize" do end it "raises ArgumentError when passed more than one argument" do - lambda { Complex(1,0).rationalize(0.1, 0.1) }.should raise_error(ArgumentError) - lambda { Complex(1,0).rationalize(0.1, 0.1, 2) }.should raise_error(ArgumentError) + -> { Complex(1,0).rationalize(0.1, 0.1) }.should raise_error(ArgumentError) + -> { Complex(1,0).rationalize(0.1, 0.1, 2) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/core/complex/shared/divide.rb b/spec/ruby/core/complex/shared/divide.rb index e3701405b9..a60802c74c 100644 --- a/spec/ruby/core/complex/shared/divide.rb +++ b/spec/ruby/core/complex/shared/divide.rb @@ -19,7 +19,7 @@ describe :complex_divide, shared: true do end it "raises a ZeroDivisionError when given zero" do - lambda { Complex(20, 40).send(@method, 0) }.should raise_error(ZeroDivisionError) + -> { Complex(20, 40).send(@method, 0) }.should raise_error(ZeroDivisionError) end it "produces Rational parts" do diff --git a/spec/ruby/core/complex/shared/rect.rb b/spec/ruby/core/complex/shared/rect.rb index 971821ac33..9f5de1ffeb 100644 --- a/spec/ruby/core/complex/shared/rect.rb +++ b/spec/ruby/core/complex/shared/rect.rb @@ -37,7 +37,7 @@ describe :complex_rect, shared: true do it "raises an ArgumentError if given any arguments" do @numbers.each do |number| - lambda { number.send(@method, number) }.should raise_error(ArgumentError) + -> { number.send(@method, number) }.should raise_error(ArgumentError) end end end @@ -57,7 +57,7 @@ describe :complex_rect_class, shared: true do it "raises TypeError" do n = mock_numeric('n') n.should_receive(:real?).any_number_of_times.and_return(false) - lambda { Complex.send(@method, n) }.should raise_error(TypeError) + -> { Complex.send(@method, n) }.should raise_error(TypeError) end end @@ -68,7 +68,7 @@ describe :complex_rect_class, shared: true do n2 = mock_numeric('n2') n1.should_receive(:real?).any_number_of_times.and_return(r1) n2.should_receive(:real?).any_number_of_times.and_return(r2) - lambda { Complex.send(@method, n1, n2) }.should raise_error(TypeError) + -> { Complex.send(@method, n1, n2) }.should raise_error(TypeError) end end end @@ -87,8 +87,8 @@ describe :complex_rect_class, shared: true do describe "passed a non-Numeric" do it "raises TypeError" do - lambda { Complex.send(@method, :sym) }.should raise_error(TypeError) - lambda { Complex.send(@method, 0, :sym) }.should raise_error(TypeError) + -> { Complex.send(@method, :sym) }.should raise_error(TypeError) + -> { Complex.send(@method, 0, :sym) }.should raise_error(TypeError) end end end diff --git a/spec/ruby/core/complex/to_f_spec.rb b/spec/ruby/core/complex/to_f_spec.rb index 12c34dfbb1..78e6526491 100644 --- a/spec/ruby/core/complex/to_f_spec.rb +++ b/spec/ruby/core/complex/to_f_spec.rb @@ -29,13 +29,13 @@ describe "Complex#to_f" do describe "when the imaginary part is non-zero" do it "raises RangeError" do - lambda { Complex(0, 1).to_f }.should raise_error(RangeError) + -> { Complex(0, 1).to_f }.should raise_error(RangeError) end end describe "when the imaginary part is Float 0.0" do it "raises RangeError" do - lambda { Complex(0, 0.0).to_f }.should raise_error(RangeError) + -> { Complex(0, 0.0).to_f }.should raise_error(RangeError) end end end diff --git a/spec/ruby/core/complex/to_i_spec.rb b/spec/ruby/core/complex/to_i_spec.rb index acdf719376..23134705ba 100644 --- a/spec/ruby/core/complex/to_i_spec.rb +++ b/spec/ruby/core/complex/to_i_spec.rb @@ -29,13 +29,13 @@ describe "Complex#to_i" do describe "when the imaginary part is non-zero" do it "raises RangeError" do - lambda { Complex(0, 1).to_i }.should raise_error(RangeError) + -> { Complex(0, 1).to_i }.should raise_error(RangeError) end end describe "when the imaginary part is Float 0.0" do it "raises RangeError" do - lambda { Complex(0, 0.0).to_i }.should raise_error(RangeError) + -> { Complex(0, 0.0).to_i }.should raise_error(RangeError) end end end diff --git a/spec/ruby/core/complex/to_r_spec.rb b/spec/ruby/core/complex/to_r_spec.rb index 46bac98ef4..76a69a0b93 100644 --- a/spec/ruby/core/complex/to_r_spec.rb +++ b/spec/ruby/core/complex/to_r_spec.rb @@ -29,13 +29,13 @@ describe "Complex#to_r" do describe "when the imaginary part is non-zero" do it "raises RangeError" do - lambda { Complex(0, 1).to_r }.should raise_error(RangeError) + -> { Complex(0, 1).to_r }.should raise_error(RangeError) end end describe "when the imaginary part is Float 0.0" do it "raises RangeError" do - lambda { Complex(0, 0.0).to_r }.should raise_error(RangeError) + -> { Complex(0, 0.0).to_r }.should raise_error(RangeError) end end end |