From de5eacfb8671d3e0acd21a9d38c7296e3437afcc Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Wed, 22 Nov 2023 11:17:40 +0100 Subject: [PATCH 1/2] Update the CI matrix and fix test suite on Rails 7.1 --- .github/workflows/ci.yml | 8 ++------ Gemfile | 2 -- test/support/acceptance_test.rb | 8 ++++++-- test/support/application_generator.rb | 6 +++++- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ba3eda24..44bc360e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,15 +6,11 @@ jobs: strategy: fail-fast: false matrix: - ruby: [ '2.7', '3.0.2', '3.1', '3.2', 'head' ] - rails: [ '6.0', '6.1', '7.0', 'edge' ] + ruby: [ '2.7', '3.0', '3.1', '3.2', 'head' ] + rails: [ '6.1', '7.0', '7.1', 'edge' ] exclude: - - ruby: '3.1' - rails: '6.0' - ruby: '3.1' rails: '6.1' - - ruby: '3.2' - rails: '6.0' - ruby: '3.2' rails: '6.1' diff --git a/Gemfile b/Gemfile index 25d1bc10..9515d42d 100644 --- a/Gemfile +++ b/Gemfile @@ -5,8 +5,6 @@ gemspec if ENV["RAILS_VERSION"] == "edge" gem "activesupport", github: "rails/rails", branch: "main" -elsif ENV['RAILS_VERSION'] == "7.0" - gem "activesupport", ">= 7.0.0.alpha" elsif ENV["RAILS_VERSION"] gem "activesupport", "~> #{ENV["RAILS_VERSION"]}.0" end diff --git a/test/support/acceptance_test.rb b/test/support/acceptance_test.rb index af2c36a0..fa28f043 100644 --- a/test/support/acceptance_test.rb +++ b/test/support/acceptance_test.rb @@ -139,7 +139,11 @@ def without_gem(name) test "raises if config.cache_classes is true" do config_path = app.path("config/environments/development.rb") config = File.read(config_path) - config.sub!(/config.cache_classes\s*=\s*false/, "config.cache_classes = true") + if config.include?("config.cache_classes") + config.sub!(/config\.cache_classes\s*=\s*false/, "config.cache_classes = true") + else # 7.1+ doesn't have config.cache_classes in the config at all + config.sub!(/config.enable_reloading = true/, "config.enable_reloading = true\nconfig.cache_classes = true") + end File.write(config_path, config) assert_failure "bin/rails runner 1", stderr: "Please, set config.cache_classes to false" @@ -258,7 +262,7 @@ def exec_name end test "binstub" do - assert_success "bin/rails server --help", stdout: /Usage:\s+rails server/ # rails command fallback + assert_success "bin/rails server --help", stdout: /Usage:\s+(bin\/)?rails server/ # rails command fallback assert_success "#{app.spring} binstub rake", stdout: "bin/rake: Spring already present" diff --git a/test/support/application_generator.rb b/test/support/application_generator.rb index 8b813495..84a3403a 100644 --- a/test/support/application_generator.rb +++ b/test/support/application_generator.rb @@ -64,7 +64,11 @@ def generate_files end rewrite_file(application.path("config/environments/test.rb")) do |c| - c.sub!(/config\.cache_classes\s*=\s*true/, "config.cache_classes = false") + if c.include?("config.cache_classes") + c.sub!(/config\.cache_classes\s*=\s*true/, "config.cache_classes = false") + else # 7.1+ doesn't have config.cache_classes in the config at all + c.sub!(/config.enable_reloading = false/, "config.enable_reloading = false\nconfig.cache_classes = false") + end c end From c03949723ca1a1961ea59e7e50496ec695a44331 Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Wed, 22 Nov 2023 12:31:57 +0100 Subject: [PATCH 2/2] Fix Gemfile on bundler 2.5.0.dev --- Gemfile | 5 +++++ spring.gemspec | 4 ---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 9515d42d..59339f17 100644 --- a/Gemfile +++ b/Gemfile @@ -3,8 +3,13 @@ source 'https://rubygems.org' # Specify your gem's dependencies in spring.gemspec gemspec +gem "rake" +gem "bump" + if ENV["RAILS_VERSION"] == "edge" gem "activesupport", github: "rails/rails", branch: "main" elsif ENV["RAILS_VERSION"] gem "activesupport", "~> #{ENV["RAILS_VERSION"]}.0" +else + gem "activesupport" end diff --git a/spring.gemspec b/spring.gemspec index 99834785..19400581 100644 --- a/spring.gemspec +++ b/spring.gemspec @@ -15,10 +15,6 @@ Gem::Specification.new do |gem| gem.required_ruby_version = ">= 2.7.0" - gem.add_development_dependency 'rake' - gem.add_development_dependency 'bump' - gem.add_development_dependency 'activesupport' - gem.metadata = { "rubygems_mfa_required" => "true", }