diff options
Diffstat (limited to 'spec/ruby/library/bigdecimal')
-rw-r--r-- | spec/ruby/library/bigdecimal/BigDecimal_spec.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/ruby/library/bigdecimal/BigDecimal_spec.rb b/spec/ruby/library/bigdecimal/BigDecimal_spec.rb index 4e839e21a3..5da0210145 100644 --- a/spec/ruby/library/bigdecimal/BigDecimal_spec.rb +++ b/spec/ruby/library/bigdecimal/BigDecimal_spec.rb @@ -112,6 +112,17 @@ describe "Kernel#BigDecimal" do neg_inf.should < 0 end + ruby_version_is "2.6" do + describe "with exception: false" do + it "returns nil for invalid strings" do + BigDecimal("invalid", exception: false).should be_nil + BigDecimal("0invalid", exception: false).should be_nil + BigDecimal("invalid0", exception: false).should be_nil + BigDecimal("0.", exception: false).should be_nil + end + end + end + describe "accepts NaN and [+-]Infinity as Float values" do it "works without an explicit precision" do BigDecimal(Float::NAN).should.nan? |