diff options
Diffstat (limited to 'spec/ruby/library/bigdecimal/fixtures/classes.rb')
-rw-r--r-- | spec/ruby/library/bigdecimal/fixtures/classes.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/ruby/library/bigdecimal/fixtures/classes.rb b/spec/ruby/library/bigdecimal/fixtures/classes.rb new file mode 100644 index 0000000000..06e4474cf0 --- /dev/null +++ b/spec/ruby/library/bigdecimal/fixtures/classes.rb @@ -0,0 +1,17 @@ +module BigDecimalSpecs + # helper method to sure that the global limit is reset back + def self.with_limit(l) + old = BigDecimal.limit(l) + yield + ensure + BigDecimal.limit(old) + end + + def self.with_rounding(r) + old = BigDecimal.mode(BigDecimal::ROUND_MODE) + BigDecimal.mode(BigDecimal::ROUND_MODE, r) + yield + ensure + BigDecimal.mode(BigDecimal::ROUND_MODE, old) + end +end |