Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support Rails 6.1 #649

Merged
merged 1 commit into from Mar 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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