diff options
Diffstat (limited to 'spec/ruby/core/math/log10_spec.rb')
| -rw-r--r-- | spec/ruby/core/math/log10_spec.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/spec/ruby/core/math/log10_spec.rb b/spec/ruby/core/math/log10_spec.rb index c4daedcd5c..7576a67002 100644 --- a/spec/ruby/core/math/log10_spec.rb +++ b/spec/ruby/core/math/log10_spec.rb @@ -4,7 +4,7 @@ require_relative 'fixtures/classes' # The common logarithm, having base 10 describe "Math.log10" do it "returns a float" do - Math.log10(1).should be_kind_of(Float) + Math.log10(1).should.is_a?(Float) end it "returns the base-10 logarithm of the argument" do @@ -16,19 +16,23 @@ describe "Math.log10" do end it "raises an Math::DomainError if the argument is less than 0" do - -> { Math.log10(-1e-15) }.should raise_error(Math::DomainError) + -> { Math.log10(-1e-15) }.should.raise(Math::DomainError) end it "raises a TypeError if the argument cannot be coerced with Float()" do - -> { Math.log10("test") }.should raise_error(TypeError) + -> { Math.log10("test") }.should.raise(TypeError) + end + + it "raises a TypeError if passed a numerical argument as a string" do + -> { Math.log10("1.0") }.should.raise(TypeError) end it "returns NaN given NaN" do - Math.log10(nan_value).nan?.should be_true + Math.log10(nan_value).nan?.should == true end it "raises a TypeError if the argument is nil" do - -> { Math.log10(nil) }.should raise_error(TypeError) + -> { Math.log10(nil) }.should.raise(TypeError) end it "accepts any argument that can be coerced with Float()" do |
