From c55d1de55c35ae030f2e17145d16d07deb43d328 Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Tue, 21 Nov 2023 11:56:24 +0000 Subject: [PATCH 001/105] v6.1.0 --- Changelog.md | 6 +++++- README.md | 6 +++--- lib/rspec/rails/version.rb | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Changelog.md b/Changelog.md index 49062ae6f..4068e9805 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,8 +1,12 @@ ### Development -[Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.0.4...main) +[Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.1.0...main) + +### 6.1.0 / 2023-11-21 +[Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.0.4...v6.1.0) Enhancements: +* Support for Rails 7.1 * Minor tweak to generated `rails_helper.rb` to use `Rails.root.join`. (@masato-bkn, Ryo Nakamura, #2640, #2678) * Add `RSpec::Rails::Configuration.fixture_paths` configuration to support diff --git a/README.md b/README.md index 7c7098fa0..781a33b0a 100644 --- a/README.md +++ b/README.md @@ -25,13 +25,13 @@ According to [RSpec Rails new versioning strategy][] use: [`rspec-rails` 3.x]: https://github.com/rspec/rspec-rails/tree/3-9-maintenance [`rspec-rails` 4.x]: https://github.com/rspec/rspec-rails/tree/4-1-maintenance [`rspec-rails` 5.x]: https://github.com/rspec/rspec-rails/tree/5-1-maintenance -[`rspec-rails` 6.x]: https://github.com/rspec/rspec-rails/tree/6-0-maintenance +[`rspec-rails` 6.x]: https://github.com/rspec/rspec-rails/tree/6-1-maintenance [RSpec Rails new versioning strategy]: https://github.com/rspec/rspec-rails/blob/main/rfcs/versioning-strategy.md ## Installation **IMPORTANT** This README / branch refers to the current development build. -See the [`6-0-maintenance` branch on Github](https://github.com/rspec/rspec-rails/tree/6-0-maintenance) if you want or require the latest stable release. +See the [`6-1-maintenance` branch on Github](https://github.com/rspec/rspec-rails/tree/6-0-maintenance) if you want or require the latest stable release. 1. Add `rspec-rails` to **both** the `:development` and `:test` groups of your app’s `Gemfile`: @@ -39,7 +39,7 @@ See the [`6-0-maintenance` branch on Github](https://github.com/rspec/rspec-rail ```ruby # Run against this stable release group :development, :test do - gem 'rspec-rails', '~> 6.0.0' + gem 'rspec-rails', '~> 6.1.0' end # Or, run against the main branch diff --git a/lib/rspec/rails/version.rb b/lib/rspec/rails/version.rb index 6b754646a..079a7d5d4 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.0.pre' + STRING = '6.2.0.pre' end end end From b8d7d7fe298b3ae1b5fefdf246d4d443348e9873 Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Tue, 21 Nov 2023 17:02:10 +0000 Subject: [PATCH 002/105] Tweak feature request template --- .github/ISSUE_TEMPLATE/feature_request.md | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 1d5caa13f..7e37aaf9d 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -3,7 +3,6 @@ name: Feature request about: Suggest an idea for this project title: '' labels: '' -assignees: '' --- From b109337c1b60ce1882208b11f887f908b70edac8 Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Tue, 21 Nov 2023 17:02:31 +0000 Subject: [PATCH 003/105] Update bug_report.md --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 151369173..251ecc506 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -47,7 +47,7 @@ Please provide a description of what you expect to be happening, and how that differs from the current behaviour. --> -## Can you provide an example app? +## Can you provide an example reproduction? - # Contributor Code of Conduct For the purpose of building a welcoming, harassment-free community that From 4dd952191c0069f4920e370f32abacf2555f3c73 Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Mon, 2 Sep 2024 15:57:38 +0100 Subject: [PATCH 102/105] Rewrite upgrade notes --- features/upgrade/README.md | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/features/upgrade/README.md b/features/upgrade/README.md index 5947fb084..059ad3223 100644 --- a/features/upgrade/README.md +++ b/features/upgrade/README.md @@ -1,18 +1,39 @@ -# Upgrading from rspec-rails 5.x to version 6 +# Upgrading + +RSpec Rails versions follow semantic versioning of x.y.z where: + +- `x` is a major release containing breaking changes and support changes for Rails. +- `y` is a minor release which will contain only feature additions and bug fixes. +- `z` is a patch release which will contain only bug fixes for the minor levels currently supported version of Rails. + +On new Rails minor releases we will usually release our own new minor version to support that version, occasionally +we will release a new major version instead to allow us to remove support for now unsupported versions of Rails +as defined by the Rails team themselves. + +The RSpec team will only maintain the current major / minor version, although it is common for the `main` branch +to contain changes for the next upcoming version of Rails and usage of this branch directly is also supported. -RSpec Rails 6 is a major version under semantic versioning, it also follows our new versioning strategy for RSpec-Rails, which is to keep in step with Rails supported versions. Thus it supports 6.1 and 7.0. There are no changes required to upgrade to RSpec Rails 6 if you are using a supported version of Rails. +# Upgrading from rspec-rails 6.x to version 7 + +RSpec Rails 7 supports Rails versions 7.0, 7.1 and 7.2. There are no changes required to upgrade from 6.x to 7 for these versions of Rails, +but we encourage those doing multiple step upgrades to upgrade to Rails 7.1 and RSpec Rails 6.1.x before upgrading to Rails 7.2 and RSpec Rails 7.0. + +If you are on Rails 6.1 you will need to keep using RSpec Rails 6.1. + +# Upgrading from rspec-rails 5.x to version 6 -If you are using an older version of Rails, you can use 5.x which hard supports 5.2 and 6.x. +RSpec Rails 6 supports Rails versions 6.1, 7.0 and 7.1. There are no changes required to upgrade from 5.x to 6 for these versions of Rails. # Upgrading from rspec-rails 4.x to version 5 -RSpec Rails 5 is a major version under semantic versioning, it also follows our new versioning strategy for RSpec-Rails, which is to keep in step with Rails supported versions. Thus it supports 5.2, 6.0 and 6.1. There are no changes required to upgrade to RSpec Rails 5 if you are using a supported version of Rails. +RSpec Rails 5 supports 5.2, 6.0 and 6.1. There are no changes required to upgrade from 4.x to 5 for these versions of Rails. If you are using an older version of Rails, you can use 4.x which hard supports 5.0 and 5.1, and soft supports 4.2 (which is unmaintained). # Upgrading from rspec-rails 3.x to version 4 -RSpec Rails 4 is a major version under semantic versioning, it allowed us to change the supported Rails versions to 5 and 6 only. There are no changes required to upgrade to RSpec Rails 4 if you are using Rails 5 or 6. +RSpec Rails 4 was the first version to be released out of step with rspec, as a major version under semantic versioning, it allowed us to change the supported Rails versions to 5 and 6 only. +There are no changes required to upgrade to RSpec Rails 4 from 3.x if you are using Rails 5 or 6. If you are using Rails 4.2 you can use RSpec Rails 4, but note that support for it is not maintained, we consider this a breaking change hence the version change, and you must be on Ruby 2.2 as a minimum. From 3b36479346daa334d2d5d89fbbdaf434af1a60d6 Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Mon, 2 Sep 2024 15:57:57 +0100 Subject: [PATCH 103/105] Drop 6.1 related code --- lib/rspec/rails/fixture_support.rb | 3 +-- lib/rspec/rails/matchers/active_job.rb | 17 +++-------------- snippets/avoid_fixture_name_collision.rb | 3 --- ...clude_activesupport_testing_tagged_logger.rb | 7 +------ .../example/controller_example_group_spec.rb | 7 +------ 5 files changed, 6 insertions(+), 31 deletions(-) diff --git a/lib/rspec/rails/fixture_support.rb b/lib/rspec/rails/fixture_support.rb index b6727d71b..e56fabeb1 100644 --- a/lib/rspec/rails/fixture_support.rb +++ b/lib/rspec/rails/fixture_support.rb @@ -10,8 +10,7 @@ module FixtureSupport include ActiveRecord::TestFixtures # @private prevent ActiveSupport::TestFixtures to start a DB transaction. - # Monkey patched to avoid collisions with 'let(:name)' in Rails 6.1 and after - # and let(:method_name) before Rails 6.1. + # Monkey patched to avoid collisions with 'let(:name)' since Rails 6.1 def run_in_transaction? current_example_name = (RSpec.current_example && RSpec.current_example.metadata[:description]) use_transactional_tests && !self.class.uses_transaction?(current_example_name) diff --git a/lib/rspec/rails/matchers/active_job.rb b/lib/rspec/rails/matchers/active_job.rb index 583f56faf..40c676c0c 100644 --- a/lib/rspec/rails/matchers/active_job.rb +++ b/lib/rspec/rails/matchers/active_job.rb @@ -148,8 +148,8 @@ def base_job_message(job) msg_parts << "on queue #{job[:queue]}" if job[:queue] msg_parts << "at #{Time.at(job[:at])}" if job[:at] msg_parts << - if fetch_priority(job) - "with priority #{fetch_priority(job)}" + if job[:priority] + "with priority #{job[:priority]}" else "with no priority specified" end @@ -167,17 +167,6 @@ def job_matches?(job) @job ? @job == job[:job] : true end - # Rails 6.1 serializes the priority with a string key - if ::Rails.version.to_f >= 7 - def fetch_priority(job) - job[:priority] - end - else - def fetch_priority(job) - job['priority'] - end - end - def arguments_match?(job) if @args.any? args = serialize_and_deserialize_arguments(@args) @@ -218,7 +207,7 @@ def queue_match?(job) def priority_match?(job) return true unless @priority - @priority == fetch_priority(job) + @priority == job[:priority] end def at_match?(job) diff --git a/snippets/avoid_fixture_name_collision.rb b/snippets/avoid_fixture_name_collision.rb index 047d5c218..37f79003d 100644 --- a/snippets/avoid_fixture_name_collision.rb +++ b/snippets/avoid_fixture_name_collision.rb @@ -47,10 +47,7 @@ RSpec.describe 'Foo' do subject { true } - # Rails 6.1 and after let(:name) { raise "Should never raise" } - # Before Rails 6.1 - let(:method_name) { raise "Should never raise" } it { is_expected.to be_truthy } end diff --git a/snippets/include_activesupport_testing_tagged_logger.rb b/snippets/include_activesupport_testing_tagged_logger.rb index c8d87caf3..f3d446c5a 100644 --- a/snippets/include_activesupport_testing_tagged_logger.rb +++ b/snippets/include_activesupport_testing_tagged_logger.rb @@ -56,12 +56,7 @@ def perform describe 'error raised in perform_enqueued_jobs with block' do it 'raises the explicitly thrown error' do - # Rails 6.1+ wraps unexpected errors in tests - expected_error = if Rails::VERSION::STRING.to_f >= 6.1 - Minitest::UnexpectedError.new(TestError) - else - TestError - end + expected_error = Minitest::UnexpectedError.new(TestError) expect { perform_enqueued_jobs { TestJob.perform_later } } .to raise_error(expected_error) diff --git a/spec/rspec/rails/example/controller_example_group_spec.rb b/spec/rspec/rails/example/controller_example_group_spec.rb index fa524b0fc..d50e88ae5 100644 --- a/spec/rspec/rails/example/controller_example_group_spec.rb +++ b/spec/rspec/rails/example/controller_example_group_spec.rb @@ -54,12 +54,7 @@ def my_helper end end - # Rails 6.1 removes config from ./activerecord/lib/active_record/test_fixtures.rb - if respond_to?(:config) - config.include mod - else - ActiveRecord::Base.include mod - end + ActiveRecord::Base.include mod group.class_exec do let(:my_helper) { "my_value" } From a5d063516049444257dad1bef2ef3e2a5be731f2 Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Mon, 2 Sep 2024 15:58:33 +0100 Subject: [PATCH 104/105] Update rails link --- lib/rspec/rails/matchers/have_http_status.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rspec/rails/matchers/have_http_status.rb b/lib/rspec/rails/matchers/have_http_status.rb index cc1b178be..91b6c9824 100644 --- a/lib/rspec/rails/matchers/have_http_status.rb +++ b/lib/rspec/rails/matchers/have_http_status.rb @@ -233,7 +233,7 @@ def set_expected_code! # expect(response).to have_http_status(:redirect) # # @see RSpec::Rails::Matchers#have_http_status - # @see https://github.com/rails/rails/blob/6-0-stable/actionpack/lib/action_dispatch/testing/test_response.rb `ActionDispatch::TestResponse` + # @see https://github.com/rails/rails/blob/7-2-stable/actionpack/lib/action_dispatch/testing/test_response.rb `ActionDispatch::TestResponse` class GenericStatus < RSpec::Rails::Matchers::BaseMatcher include HaveHttpStatus From 1bb407e749e41e4fd7de898771833284476e0b03 Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Mon, 2 Sep 2024 16:34:17 +0100 Subject: [PATCH 105/105] v7.0.0 --- Changelog.md | 5 ++++- README.md | 5 +++-- lib/rspec/rails/version.rb | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Changelog.md b/Changelog.md index 5e968764d..21ac7a000 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,8 @@ ### Development -[Full Changelog](https://github.com/rspec/rspec-rails/compare/v7.0.0...main) +[Full Changelog](https://github.com/rspec/rspec-rails/compare/v7.0.0...7-0-maintenance) + +### 7.0.0 / 2024-09-02 +[Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.1.5...v7.0.0) Enhancements: diff --git a/README.md b/README.md index 2d8e271f8..2cd924513 100644 --- a/README.md +++ b/README.md @@ -32,8 +32,9 @@ According to [RSpec Rails new versioning strategy][] use: ## Installation -**IMPORTANT** This README / branch refers to the current development build. -See the [`7-0-maintenance` branch on Github](https://github.com/rspec/rspec-rails/tree/7-0-maintenance) if you want or require the latest stable release. +**IMPORTANT** This README / branch refers to the 7.0.x stable release series, only bugfixes from this series will +be added here. See the [`main` branch on Github](https://github.com/rspec/rspec-rails/tree/main) if you want or +require the latest unstable features. 1. Add `rspec-rails` to **both** the `:development` and `:test` groups of your app’s `Gemfile`: diff --git a/lib/rspec/rails/version.rb b/lib/rspec/rails/version.rb index cd746b581..883fca892 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 = '7.0.0.pre' + STRING = '7.0.0' end end end