Skip to content

Commit

Permalink
Test with Rails 8.0.0.beta1 on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Sep 27, 2024
1 parent efcf66f commit be103a8
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ jobs:
fail-fast: false
matrix:
include:
- ruby: 3.3
gemfile: gemfiles/activerecord80.gemfile
- ruby: 3.3
gemfile: Gemfile
- ruby: 3.2
Expand Down
11 changes: 11 additions & 0 deletions gemfiles/activerecord80.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
source "https://rubygems.org"

gemspec path: ".."

gem "rake"
gem "minitest"
gem "activerecord", "~> 8.0.0.beta1"
gem "pg"
gem "mysql2"
gem "trilogy"
gem "sqlite3"
2 changes: 1 addition & 1 deletion lib/groupdate/magic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def time_zone_support?(relation)
if relation.connection.adapter_name.match?(/mysql/i)
# need to call klass for Rails < 5.2
sql = relation.klass.send(:sanitize_sql_array, ["SELECT CONVERT_TZ(NOW(), '+00:00', ?)", time_zone.tzinfo.name])
!relation.connection.select_all(sql).first.values.first.nil?
!relation.connection.select_all(sql).to_a.first.values.first.nil?
else
true
end
Expand Down
8 changes: 7 additions & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
if adapter != "enumerable" && ActiveRecord::VERSION::STRING.to_f >= 7.1
# must come before ActiveRecord::Base.establish_connection
ActiveRecord.async_query_executor = :global_thread_pool

if ActiveRecord::VERSION::MAJOR >= 8
ActiveRecord::Base.asynchronous_queries_tracker.start_session
end
end

puts "Using #{adapter}"
Expand All @@ -33,7 +37,9 @@
formats: {special: "%b %e, %Y"}
}

if ActiveSupport::VERSION::STRING.to_f == 7.2
if ActiveSupport::VERSION::STRING.to_f == 8.0
ActiveSupport.to_time_preserves_timezone = :zone
elsif ActiveSupport::VERSION::STRING.to_f == 7.2
ActiveSupport.to_time_preserves_timezone = true
end

Expand Down

0 comments on commit be103a8

Please sign in to comment.