diff options
Diffstat (limited to 'spec/ruby/optional/capi/numeric_spec.rb')
| -rw-r--r-- | spec/ruby/optional/capi/numeric_spec.rb | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/spec/ruby/optional/capi/numeric_spec.rb b/spec/ruby/optional/capi/numeric_spec.rb index e9667da5ba..abfed13503 100644 --- a/spec/ruby/optional/capi/numeric_spec.rb +++ b/spec/ruby/optional/capi/numeric_spec.rb @@ -9,7 +9,7 @@ describe "CApiNumericSpecs" do describe "NUM2INT" do it "raises a TypeError if passed nil" do - -> { @s.NUM2INT(nil) }.should raise_error(TypeError) + -> { @s.NUM2INT(nil) }.should.raise(TypeError) end it "converts a Float" do @@ -33,7 +33,7 @@ describe "CApiNumericSpecs" do end it "raises a RangeError if the value is more than 32bits" do - -> { @s.NUM2INT(0xffff_ffff+1) }.should raise_error(RangeError) + -> { @s.NUM2INT(0xffff_ffff+1) }.should.raise(RangeError) end it "calls #to_int to coerce the value" do @@ -45,7 +45,7 @@ describe "CApiNumericSpecs" do describe "NUM2UINT" do it "raises a TypeError if passed nil" do - -> { @s.NUM2UINT(nil) }.should raise_error(TypeError) + -> { @s.NUM2UINT(nil) }.should.raise(TypeError) end it "converts a Float" do @@ -69,17 +69,17 @@ describe "CApiNumericSpecs" do end it "raises a RangeError if the value is more than 32bits" do - -> { @s.NUM2UINT(0xffff_ffff+1) }.should raise_error(RangeError) + -> { @s.NUM2UINT(0xffff_ffff+1) }.should.raise(RangeError) end it "raises a RangeError if the value is less than 32bits negative" do - -> { @s.NUM2UINT(-0x8000_0000-1) }.should raise_error(RangeError) + -> { @s.NUM2UINT(-0x8000_0000-1) }.should.raise(RangeError) end it "raises a RangeError if the value is more than 64bits" do -> do @s.NUM2UINT(0xffff_ffff_ffff_ffff+1) - end.should raise_error(RangeError) + end.should.raise(RangeError) end it "calls #to_int to coerce the value" do @@ -91,7 +91,7 @@ describe "CApiNumericSpecs" do describe "NUM2LONG" do it "raises a TypeError if passed nil" do - -> { @s.NUM2LONG(nil) }.should raise_error(TypeError) + -> { @s.NUM2LONG(nil) }.should.raise(TypeError) end it "converts a Float" do @@ -116,7 +116,7 @@ describe "CApiNumericSpecs" do end it "raises a RangeError if the value is more than 32bits" do - -> { @s.NUM2LONG(0xffff_ffff+1) }.should raise_error(RangeError) + -> { @s.NUM2LONG(0xffff_ffff+1) }.should.raise(RangeError) end end @@ -132,7 +132,7 @@ describe "CApiNumericSpecs" do it "raises a RangeError if the value is more than 64bits" do -> do @s.NUM2LONG(0xffff_ffff_ffff_ffff+1) - end.should raise_error(RangeError) + end.should.raise(RangeError) end end @@ -145,7 +145,7 @@ describe "CApiNumericSpecs" do describe "NUM2SHORT" do it "raises a TypeError if passed nil" do - -> { @s.NUM2SHORT(nil) }.should raise_error(TypeError) + -> { @s.NUM2SHORT(nil) }.should.raise(TypeError) end it "converts a Float" do @@ -161,7 +161,7 @@ describe "CApiNumericSpecs" do end it "raises a RangeError if the value is more than 32bits" do - -> { @s.NUM2SHORT(0xffff_ffff+1) }.should raise_error(RangeError) + -> { @s.NUM2SHORT(0xffff_ffff+1) }.should.raise(RangeError) end it "calls #to_int to coerce the value" do @@ -173,7 +173,7 @@ describe "CApiNumericSpecs" do describe "INT2NUM" do it "raises a TypeError if passed nil" do - -> { @s.INT2NUM(nil) }.should raise_error(TypeError) + -> { @s.INT2NUM(nil) }.should.raise(TypeError) end it "converts a Float" do @@ -181,7 +181,7 @@ describe "CApiNumericSpecs" do end it "raises a RangeError when passed a Bignum" do - -> { @s.INT2NUM(bignum_value) }.should raise_error(RangeError) + -> { @s.INT2NUM(bignum_value) }.should.raise(RangeError) end it "converts a Fixnum" do @@ -195,7 +195,7 @@ describe "CApiNumericSpecs" do describe "NUM2ULONG" do it "raises a TypeError if passed nil" do - -> { @s.NUM2ULONG(nil) }.should raise_error(TypeError) + -> { @s.NUM2ULONG(nil) }.should.raise(TypeError) end it "converts a Float" do @@ -227,7 +227,7 @@ describe "CApiNumericSpecs" do end it "raises a RangeError if the value is more than 32bits" do - -> { @s.NUM2ULONG(0xffff_ffff+1) }.should raise_error(RangeError) + -> { @s.NUM2ULONG(0xffff_ffff+1) }.should.raise(RangeError) end end @@ -250,7 +250,7 @@ describe "CApiNumericSpecs" do it "raises a RangeError if the value is more than 64bits" do -> do @s.NUM2ULONG(0xffff_ffff_ffff_ffff+1) - end.should raise_error(RangeError) + end.should.raise(RangeError) end end @@ -308,11 +308,11 @@ describe "CApiNumericSpecs" do describe "NUM2DBL" do it "raises a TypeError if passed nil" do - -> { @s.NUM2DBL(nil) }.should raise_error(TypeError) + -> { @s.NUM2DBL(nil) }.should.raise(TypeError) end it "raises a TypeError if passed a String" do - -> { @s.NUM2DBL("1.2") }.should raise_error(TypeError) + -> { @s.NUM2DBL("1.2") }.should.raise(TypeError) end it "converts a Float" do @@ -348,13 +348,13 @@ describe "CApiNumericSpecs" do end it "raises a TypeError when passed an empty String" do - -> { @s.NUM2CHR("") }.should raise_error(TypeError) + -> { @s.NUM2CHR("") }.should.raise(TypeError) end end describe "rb_num_zerodiv" do it "raises a RuntimeError" do - -> { @s.rb_num_zerodiv() }.should raise_error(ZeroDivisionError, 'divided by 0') + -> { @s.rb_num_zerodiv() }.should.raise(ZeroDivisionError, 'divided by 0') end end @@ -386,7 +386,7 @@ describe "CApiNumericSpecs" do it "raises an ArgumentError when passed nil" do -> { @s.rb_cmpint(nil, 4) - }.should raise_error(ArgumentError) + }.should.raise(ArgumentError) end end @@ -410,7 +410,7 @@ describe "CApiNumericSpecs" do obj = mock("rb_num_coerce_bin") obj.should_receive(:coerce).with(2).and_return(nil) - -> { @s.rb_num_coerce_bin(2, obj, :+) }.should raise_error(TypeError) + -> { @s.rb_num_coerce_bin(2, obj, :+) }.should.raise(TypeError) end end @@ -435,14 +435,14 @@ describe "CApiNumericSpecs" do obj.should_receive(:coerce).with(2).and_raise(RuntimeError.new("my error")) -> { @s.rb_num_coerce_cmp(2, obj, :<=>) - }.should raise_error(RuntimeError, "my error") + }.should.raise(RuntimeError, "my error") end it "returns nil if #coerce does not return an Array" do obj = mock("rb_num_coerce_cmp") obj.should_receive(:coerce).with(2).and_return(nil) - @s.rb_num_coerce_cmp(2, obj, :<=>).should be_nil + @s.rb_num_coerce_cmp(2, obj, :<=>).should == nil end end @@ -451,7 +451,7 @@ describe "CApiNumericSpecs" do obj = mock("rb_num_coerce_relop") obj.should_receive(:coerce).with(2).and_return([1, 2]) - @s.rb_num_coerce_relop(2, obj, :<).should be_true + @s.rb_num_coerce_relop(2, obj, :<).should == true end it "calls the specified method on the first argument returned by #coerce" do @@ -459,7 +459,7 @@ describe "CApiNumericSpecs" do obj.should_receive(:coerce).with(2).and_return([obj, 2]) obj.should_receive(:<).with(2).and_return(false) - @s.rb_num_coerce_relop(2, obj, :<).should be_false + @s.rb_num_coerce_relop(2, obj, :<).should == false end it "raises an ArgumentError if #<op> returns nil" do @@ -467,14 +467,14 @@ describe "CApiNumericSpecs" do obj.should_receive(:coerce).with(2).and_return([obj, 2]) obj.should_receive(:<).with(2).and_return(nil) - -> { @s.rb_num_coerce_relop(2, obj, :<) }.should raise_error(ArgumentError) + -> { @s.rb_num_coerce_relop(2, obj, :<) }.should.raise(ArgumentError) end it "raises an ArgumentError if #coerce does not return an Array" do obj = mock("rb_num_coerce_relop") obj.should_receive(:coerce).with(2).and_return(nil) - -> { @s.rb_num_coerce_relop(2, obj, :<) }.should raise_error(ArgumentError) + -> { @s.rb_num_coerce_relop(2, obj, :<) }.should.raise(ArgumentError) end end |
