Skip to content

Fix deprecation warning from Rails 8 alpha #2768

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

Merged
merged 3 commits into from
Jun 19, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Gemfile-rails-dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ def add_net_gems_dependency
end

# sqlite3 is an optional, unspecified, dependency and Rails 6.0 only supports `~> 1.4`
gem 'sqlite3', '~> 1.4', platforms: [:ruby]
if RUBY_VERSION.to_f < 3
# sqlite3 1.7.x doesn't work on all platforms for Ruby 2.x
gem 'sqlite3', '~> 1.4', '< 1.7', platforms: [:ruby]
else
gem 'sqlite3', '~> 1.4', platforms: [:ruby]
end

if RUBY_VERSION.to_f < 2.7
gem 'puma', '< 6.0.0'
Expand Down
8 changes: 6 additions & 2 deletions example_app_generator/generate_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@

gsub_file "Gemfile", /.*rails-controller-testing.*/, "gem 'rails-controller-testing', git: 'https://github.com/rails/rails-controller-testing'"

# sqlite3 is an optional, unspecified, dependency and Rails 6.0 only supports `~> 1.4`
gsub_file "Gemfile", /.*gem..sqlite3.*/, "gem 'sqlite3', '~> 1.4'"
# sqlite3 is an optional, unspecified, dependency and Rails 6.0 only supports `~> 1.4`, and Ruby 2.7 only supports < 1.7
if RUBY_VERSION.to_f < 3
gsub_file "Gemfile", /.*gem..sqlite3.*/, "gem 'sqlite3', '~> 1.4', '< 1.7'"
else
gsub_file "Gemfile", /.*gem..sqlite3.*/, "gem 'sqlite3', '~> 1.4'"
end

# remove webdrivers
gsub_file "Gemfile", /gem ['"]webdrivers['"]/, ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def capture_exec(*ops)
CaptureExec.new(out, $?.exitstatus)
end

if ENV['RAILS_VERSION'] == 'main' && Rails::VERSION::STRING == "7.2.0.alpha"
if ENV['RAILS_VERSION'] == 'main' && Rails::VERSION::STRING == "8.0.0.alpha"
before do
skip('This is broken on Rails main but is skipped for green builds of 7.1.x, please fix')
end
Expand Down
5 changes: 5 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ def self.run_all(reporter = nil)
end
end

# This behaviour will become the default in Rails 8, for now it silences a deprecation
if ActiveSupport.respond_to?(:to_time_preserves_timezone)
ActiveSupport.to_time_preserves_timezone = true
end

# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
# Bring in the failure matchers from rspec-expectations
Expand Down
Loading