From e881d928c90ada59d228e4dec22b9aa74ed8d8a2 Mon Sep 17 00:00:00 2001 From: Petr Chalupa Date: Sat, 28 Nov 2015 14:37:50 +0100 Subject: [PATCH] do not raise when precision is passed to BigDecimal#round --- spec/ruby/library/bigdecimal/round_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/ruby/library/bigdecimal/round_spec.rb b/spec/ruby/library/bigdecimal/round_spec.rb index a1fb8d89f5e..6c1987c5d8d 100644 --- a/spec/ruby/library/bigdecimal/round_spec.rb +++ b/spec/ruby/library/bigdecimal/round_spec.rb @@ -193,4 +193,10 @@ lambda { BigDecimal('Infinity').round }.should raise_error(FloatDomainError) lambda { BigDecimal('-Infinity').round }.should raise_error(FloatDomainError) end + + it 'do not raise exception, if self is special value and precision is given' do + lambda { BigDecimal('NaN').round(2) }.should_not raise_error(FloatDomainError) + lambda { BigDecimal('Infinity').round(2) }.should_not raise_error(FloatDomainError) + lambda { BigDecimal('-Infinity').round(2) }.should_not raise_error(FloatDomainError) + end end