Skip to content

Commit

Permalink
Compare to Float::INFINITY instead of using 'infinite?' method to bet…
Browse files Browse the repository at this point in the history
…ter match labels of the cases.
  • Loading branch information
oldgreen committed May 3, 2012
1 parent 3d05972 commit b417d7b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions spec/ruby/core/math/gamma_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ruby_version_is "1.9" do
describe "Math.gamma" do
it "returns +infinity given 0" do
Math.gamma(0).infinite?.should == 1
Math.gamma(0).should == Float::INFINITY
end

it "returns Math.sqrt(Math::PI) given 0.5" do
Expand Down Expand Up @@ -39,11 +39,11 @@

# See http://redmine.ruby-lang.org/issues/show/2189
it "returns +infinity given +infinity" do
Math.gamma(infinity_value).infinite?.should == 1
Math.gamma(Float::INFINITY).should == Float::INFINITY
end

it "raises Math::DomainError given negative infinity" do
lambda { Math.gamma(-infinity_value) }.should raise_error(Math::DomainError)
lambda { Math.gamma(-Float::INFINITY) }.should raise_error(Math::DomainError)
end

it "returns NaN given NaN" do
Expand Down

0 comments on commit b417d7b

Please sign in to comment.