diff options
Diffstat (limited to 'spec/ruby/core/math/log_spec.rb')
| -rw-r--r-- | spec/ruby/core/math/log_spec.rb | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/spec/ruby/core/math/log_spec.rb b/spec/ruby/core/math/log_spec.rb index 9bcccb55e2..7e0bc13bc6 100644 --- a/spec/ruby/core/math/log_spec.rb +++ b/spec/ruby/core/math/log_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 natural logarithm, having base Math::E describe "Math.log" do it "returns a float" do - Math.log(1).should be_kind_of(Float) + Math.log(1).should.is_a?(Float) end it "returns the natural logarithm of the argument" do @@ -15,18 +15,16 @@ describe "Math.log" do Math.log(10e15).should be_close(36.8413614879047, TOLERANCE) end - conflicts_with :Complex do - it "raises an Errno::EDOM if the argument is less than 0" do - lambda { Math.log(-1e-15) }.should raise_error(Errno::EDOM) - end + it "raises an Math::DomainError if the argument is less than 0" do + -> { Math.log(-1e-15) }.should.raise(Math::DomainError) end it "raises a TypeError if the argument cannot be coerced with Float()" do - lambda { Math.log("test") }.should raise_error(TypeError) + -> { Math.log("test") }.should.raise(TypeError) end it "raises a TypeError for numerical values passed as string" do - lambda { Math.log("10") }.should raise_error(TypeError) + -> { Math.log("10") }.should.raise(TypeError) end it "accepts a second argument for the base" do @@ -35,16 +33,16 @@ describe "Math.log" do end it "raises a TypeError when the numerical base cannot be coerced to a float" do - lambda { Math.log(10, "2") }.should raise_error(TypeError) - lambda { Math.log(10, nil) }.should raise_error(TypeError) + -> { Math.log(10, "2") }.should.raise(TypeError) + -> { Math.log(10, nil) }.should.raise(TypeError) end it "returns NaN given NaN" do - Math.log(nan_value).nan?.should be_true + Math.log(nan_value).nan?.should == true end it "raises a TypeError if the argument is nil" do - lambda { Math.log(nil) }.should raise_error(TypeError) + -> { Math.log(nil) }.should.raise(TypeError) end it "accepts any argument that can be coerced with Float()" do |
