summaryrefslogtreecommitdiff
path: root/spec/ruby/core/math/log10_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/math/log10_spec.rb')
-rw-r--r--spec/ruby/core/math/log10_spec.rb22
1 files changed, 12 insertions, 10 deletions
diff --git a/spec/ruby/core/math/log10_spec.rb b/spec/ruby/core/math/log10_spec.rb
index 8164b9994d..7576a67002 100644
--- a/spec/ruby/core/math/log10_spec.rb
+++ b/spec/ruby/core/math/log10_spec.rb
@@ -1,10 +1,10 @@
-require File.expand_path('../../../spec_helper', __FILE__)
-require File.expand_path('../fixtures/classes', __FILE__)
+require_relative '../../spec_helper'
+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
@@ -15,22 +15,24 @@ describe "Math.log10" do
Math.log10(10e15).should be_close(16.0, TOLERANCE)
end
- conflicts_with :Complex do
- it "raises an Errno::EDOM if the argument is less than 0" do
- lambda { Math.log10(-1e-15) }.should raise_error( Errno::EDOM)
- end
+ it "raises an Math::DomainError if the argument is less than 0" do
+ -> { Math.log10(-1e-15) }.should.raise(Math::DomainError)
end
it "raises a TypeError if the argument cannot be coerced with Float()" do
- lambda { 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
- lambda { 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