Sha256: eb5b44cc9a78c4c47d4de88cc2551f42d6da49b22b2c81666aa9c7bed5476758
Contents?: true
Size: 801 Bytes
Versions: 44
Compression:
Stored size: 801 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 def test_invalid_encoding assert_raises(EncodingError) { Oj.dump("\"\xf3j", mode: :rails) } assert_raises(EncodingError) { Oj.dump("\xf3j", mode: :rails) } end end
Version data entries
44 entries across 44 versions & 2 rubygems