Sha256: 7ae0d0ee8ab4dc995d71428f6536a36fbc75d55e79c24939c3ab2a14bdb6965d
Contents?: true
Size: 788 Bytes
Versions: 37
Compression:
Stored size: 788 Bytes
Contents
#!/usr/bin/env ruby $: << File.dirname(__FILE__) $: << File.dirname(File.dirname(__FILE__)) require 'helper' require "rails/all" Oj::Rails.set_encoder() Oj::Rails.optimize() Oj.default_options = { mode: :rails } class ActiveRecordResultTest < Minitest::Test def test_hash_rows result = ActiveRecord::Result.new(["one", "two"], [ ["row 1 col 1", "row 1 col 2"], ["row 2 col 1", "row 2 col 2"], ["row 3 col 1", "row 3 col 2"], ]) #puts "*** result: #{Oj.dump(result, indent: 2)}" json_result = if ActiveRecord.version >= Gem::Version.new("6") result.to_a else result.to_hash end assert_equal Oj.dump(result, mode: :rails), Oj.dump(json_result) end end
Version data entries
37 entries across 37 versions & 2 rubygems