diff --git a/Changelog.md b/Changelog.md index 6750c8161a..3070130c1d 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,13 @@ ### Development -[Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.1.4...6-1-maintenance) +[Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.1.5...6-1-maintenance) + +### 6.1.5 / 2024-09-02 +[Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.1.4...v6.1.5) + +Bug Fixes: + +* Restore old order of requiring support files. (Franz Liedke, #2785) +* Prevent running `rake spec:statsetup` on Rails main / 8.0.0. (Petrik de Heus, #2781) ### 6.1.4 / 2024-08-15 [Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.1.3...v6.1.4) diff --git a/Gemfile-rails-dependencies b/Gemfile-rails-dependencies index 7b1289f5f6..d8487f7fa7 100644 --- a/Gemfile-rails-dependencies +++ b/Gemfile-rails-dependencies @@ -11,12 +11,14 @@ def add_net_gems_dependency end end -# sqlite3 is an optional, unspecified, dependency and Rails 6.0 only supports `~> 1.4` -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] +def add_sqlite3_gem_dependency + # sqlite3 is an optional, unspecified, dependency and Rails 6.0 only supports `~> 1.4` + 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 end if RUBY_VERSION.to_f < 2.7 @@ -30,6 +32,9 @@ when /main/ gem "rails", :git => "https://github.com/rails/rails.git" gem 'activerecord-jdbcsqlite3-adapter', git: 'https://github.com/jruby/activerecord-jdbc-adapter', platforms: [:jruby] gem 'selenium-webdriver', require: false + + # Rails 8 requires 2.0.0 + gem 'sqlite3', '~> 2.0', platforms: [:ruby] when /stable$/ gem_list = %w[rails railties actionmailer actionpack activerecord activesupport activejob actionview] gem 'activerecord-jdbcsqlite3-adapter', git: 'https://github.com/jruby/activerecord-jdbc-adapter', platforms: [:jruby] @@ -37,10 +42,12 @@ when /stable$/ gem_list.each do |rails_gem| gem rails_gem, :git => "https://github.com/rails/rails.git", :branch => version end + add_sqlite3_gem_dependency when nil, false, "" gem "rails", "~> 7.0.0" gem 'activerecord-jdbcsqlite3-adapter', platforms: [:jruby] gem 'selenium-webdriver', require: false + add_sqlite3_gem_dependency else version_number = version.split(' ').last add_net_gems_dependency if version_number < '7.0' @@ -55,4 +62,5 @@ else else gem 'selenium-webdriver', require: false end + add_sqlite3_gem_dependency end diff --git a/example_app_generator/generate_app.rb b/example_app_generator/generate_app.rb index c5b519f59c..b9a97e0cb7 100644 --- a/example_app_generator/generate_app.rb +++ b/example_app_generator/generate_app.rb @@ -29,9 +29,11 @@ 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`, and Ruby 2.7 only supports < 1.7 + # sqlite3 is an optional, unspecified, dependency of which Rails 6.0 only supports `~> 1.4`, Ruby 2.7 only supports < 1.7 and Rails 8.0 only supports `~> 2.0` if RUBY_VERSION.to_f < 3 gsub_file "Gemfile", /.*gem..sqlite3.*/, "gem 'sqlite3', '~> 1.4', '< 1.7'" + elsif Rails::VERSION::STRING > '8' + gsub_file "Gemfile", /.*gem..sqlite3.*/, "gem 'sqlite3', '~> 2.0'" else gsub_file "Gemfile", /.*gem..sqlite3.*/, "gem 'sqlite3', '~> 1.4'" end diff --git a/lib/generators/rspec/install/templates/spec/rails_helper.rb b/lib/generators/rspec/install/templates/spec/rails_helper.rb index 166d47d5d6..afb68850e9 100644 --- a/lib/generators/rspec/install/templates/spec/rails_helper.rb +++ b/lib/generators/rspec/install/templates/spec/rails_helper.rb @@ -20,7 +20,7 @@ # directory. Alternatively, in the individual `*_spec.rb` files, manually # require only the support files necessary. # -# Rails.root.glob('spec/support/**/*.rb').sort.each { |f| require f } +# Rails.root.glob('spec/support/**/*.rb').sort_by(&:to_s).each { |f| require f } <% if RSpec::Rails::FeatureCheck.has_active_record_migration? -%> # Checks for pending migrations and applies them before tests are run. diff --git a/lib/rspec-rails.rb b/lib/rspec-rails.rb index 9c16b36a26..8804a67f5d 100644 --- a/lib/rspec-rails.rb +++ b/lib/rspec-rails.rb @@ -9,6 +9,7 @@ class Railtie < ::Rails::Railtie # As of Rails 5.1.0 you can register directories to work with `rake notes` require 'rails/source_annotation_extractor' ::Rails::SourceAnnotationExtractor::Annotation.register_directories("spec") + generators = config.app_generators generators.integration_tool :rspec generators.test_framework :rspec diff --git a/lib/rspec/rails/tasks/rspec.rake b/lib/rspec/rails/tasks/rspec.rake index fc3add7875..f466e61dc0 100644 --- a/lib/rspec/rails/tasks/rspec.rake +++ b/lib/rspec/rails/tasks/rspec.rake @@ -5,7 +5,9 @@ end task default: :spec -task stats: "spec:statsetup" +if ::Rails::VERSION::STRING < "8.0.0" + task stats: "spec:statsetup" +end desc "Run all specs in spec directory (excluding plugin specs)" RSpec::Core::RakeTask.new(spec: "spec:prepare") diff --git a/lib/rspec/rails/version.rb b/lib/rspec/rails/version.rb index 7b9afc9f38..b7df4ae169 100644 --- a/lib/rspec/rails/version.rb +++ b/lib/rspec/rails/version.rb @@ -3,7 +3,7 @@ module Rails # Version information for RSpec Rails. module Version # Current version of RSpec Rails, in semantic versioning format. - STRING = '6.1.4' + STRING = '6.1.5' end end end diff --git a/rspec-rails.gemspec b/rspec-rails.gemspec index 0c1d752b2d..4e5ffec211 100644 --- a/rspec-rails.gemspec +++ b/rspec-rails.gemspec @@ -10,7 +10,7 @@ Gem::Specification.new do |s| s.email = "rspec@googlegroups.com" s.homepage = "https://github.com/rspec/rspec-rails" s.summary = "RSpec for Rails" - s.description = "rspec-rails is a testing framework for Rails 5+." + s.description = "rspec-rails integrates the Rails testing helpers into RSpec." s.required_ruby_version = ">= 2.5.0" s.metadata = {