Sha256: 844442485eabf6fb01132b2c567095da60c9a91a13f158e3cb3dc67740c39085

Contents?: true

Size: 580 Bytes

Versions: 8

Compression:

Stored size: 580 Bytes

Contents

# encoding: UTF-8

require 'helper'
Oj.mimic_JSON
require 'rails/all'

class MimicRails < Minitest::Test

  def test_mimic_exception
    begin
      ActiveSupport::JSON.decode("{")
      puts "Failed"
    rescue ActiveSupport::JSON.parse_error
      assert(true)
    rescue Exception
      assert(false, 'Expected a JSON::ParserError')
    end
  end

  def test_dump_string
    Oj.default_options= {:indent => 2} # JSON this will not change anything
    json = ActiveSupport::JSON.encode([1, true, nil])
    assert_equal(%{[
  1,
  true,
  null
]
}, json)
  end

end # MimicRails

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
oj-2.10.2 test/_test_mimic_rails.rb
oj-2.10.1 test/_test_mimic_rails.rb
oj-2.10.0 test/_test_mimic_rails.rb
oj-2.9.9 test/_test_mimic_rails.rb
oj-2.9.8 test/_test_mimic_rails.rb
oj-2.9.7 test/_test_mimic_rails.rb
oj-2.9.6 test/_test_mimic_rails.rb
oj-2.9.5 test/_test_mimic_rails.rb