Sha256: 18b515926d791b15b2ed57947dd093211ce21f2abd518189fa751f855b92efe4

Contents?: true

Size: 608 Bytes

Versions: 15

Compression:

Stored size: 608 Bytes

Contents

#!/usr/bin/env ruby
# encoding: utf-8

$: << File.dirname(__FILE__)

require 'helper'

class RailsJuice < Minitest::Test

  def test_bigdecimal_dump
    orig = Oj.default_options
    Oj.default_options = { mode: :rails, bigdecimal_as_decimal: true }
    bd = BigDecimal('123')
    json = Oj.dump(bd)
    Oj.default_options = orig

    assert_equal('0.123e3', json.downcase)

    json = Oj.dump(bd, mode: :rails, bigdecimal_as_decimal: false)
    assert_equal('"0.123e3"', json.downcase)

    json = Oj.dump(bd, mode: :rails, bigdecimal_as_decimal: true)
    assert_equal('0.123e3', json.downcase)
  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
oj-3.10.16 test/test_rails.rb
oj-3.10.15 test/test_rails.rb
oj-3.10.14 test/test_rails.rb
oj-3.10.13 test/test_rails.rb
oj-3.10.12 test/test_rails.rb
oj-3.10.11 test/test_rails.rb
oj-3.10.10 test/test_rails.rb
oj-3.10.9 test/test_rails.rb
oj-3.10.8 test/test_rails.rb
oj-3.10.7 test/test_rails.rb
oj-3.10.6 test/test_rails.rb
oj-3.10.5 test/test_rails.rb
oj-3.10.3 test/test_rails.rb
oj-3.10.2 test/test_rails.rb
oj-3.10.1 test/test_rails.rb