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

Version Path
devcycle-ruby-server-sdk-2.0.0 vendor/bundle/ruby/3.0.0/gems/oj-3.13.2/test/activerecord/result_test.rb
oj-3.14.2 test/activerecord/result_test.rb
oj-3.14.1 test/activerecord/result_test.rb
oj-3.14.0 test/activerecord/result_test.rb
oj-3.13.23 test/activerecord/result_test.rb
oj-3.13.22 test/activerecord/result_test.rb
oj-3.13.21 test/activerecord/result_test.rb
oj-3.13.20 test/activerecord/result_test.rb
oj-3.13.19 test/activerecord/result_test.rb
oj-3.13.18 test/activerecord/result_test.rb
oj-3.13.17 test/activerecord/result_test.rb
oj-3.13.16 test/activerecord/result_test.rb
oj-3.13.15 test/activerecord/result_test.rb
oj-3.13.14 test/activerecord/result_test.rb
oj-3.13.13 test/activerecord/result_test.rb
oj-3.13.12 test/activerecord/result_test.rb
oj-3.13.11 test/activerecord/result_test.rb
oj-3.13.10 test/activerecord/result_test.rb
oj-3.13.9 test/activerecord/result_test.rb
oj-3.13.8 test/activerecord/result_test.rb