Skip to content

Commit

Permalink
Add support Rails 6.1 (#649)
Browse files Browse the repository at this point in the history
  • Loading branch information
randsina committed Mar 31, 2021
1 parent 36aef54 commit a4f4590
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Expand Up @@ -20,6 +20,7 @@ gemfile:
- gemfiles/no_rails.gemfile
- gemfiles/rails_5.gemfile
- gemfiles/rails_6.gemfile
- gemfiles/rails_6.1.gemfile

matrix:
fast_finish: true
Expand All @@ -40,6 +41,8 @@ matrix:
# Rails 6 only support Ruby 2.5 and above.
- gemfile: gemfiles/rails_6.gemfile
rvm: 2.4.10
- gemfile: gemfiles/rails_6.1.gemfile
rvm: 2.4.10
- os: osx
rvm: 2.4.10
- os: osx
Expand Down
4 changes: 2 additions & 2 deletions Rakefile
Expand Up @@ -23,7 +23,7 @@ task :test_all => [:clean, :compile] do
cmds = "ruby test/tests.rb && ruby test/tests_mimic.rb && ruby test/tests_mimic_addition.rb"
puts "\n" + "#"*90
puts cmds
Bundler.with_clean_env do
Bundler.with_original_env do
status = system(cmds)
end
exitcode = 1 unless status
Expand All @@ -36,7 +36,7 @@ task :test_all => [:clean, :compile] do
cmd = "REAL_JSON_GEM=1 bundle exec ruby -Itest #{file}"
puts "\n" + "#"*90
puts cmd
Bundler.with_clean_env do
Bundler.with_original_env do
status = system(cmd)
end
exitcode = 1 unless status
Expand Down
6 changes: 6 additions & 0 deletions gemfiles/rails_6.1.gemfile
@@ -0,0 +1,6 @@
source "https://rubygems.org"

gem "rails", "6.1.3.1"
gem "sqlite3"

gemspec :path => "../"
9 changes: 7 additions & 2 deletions test/activerecord/result_test.rb
Expand Up @@ -21,7 +21,12 @@ def test_hash_rows
["row 3 col 1", "row 3 col 2"],
])
#puts "*** result: #{Oj.dump(result, indent: 2)}"

assert_equal Oj.dump(result, mode: :rails), Oj.dump(result.to_hash)
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

0 comments on commit a4f4590

Please sign in to comment.