From fe98027eab1e47510fd0bd83c7e122de3c391e2c Mon Sep 17 00:00:00 2001 From: Nicholas Simmons Date: Thu, 6 Apr 2023 09:55:24 -0400 Subject: [PATCH 1/2] Fix deprecated TestFixtures#fixture_path call --- lib/rspec/rails/fixture_support.rb | 7 ++++++- spec/rspec/rails/configuration_spec.rb | 10 ++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/rspec/rails/fixture_support.rb b/lib/rspec/rails/fixture_support.rb index 7624cb364..de61e66af 100644 --- a/lib/rspec/rails/fixture_support.rb +++ b/lib/rspec/rails/fixture_support.rb @@ -21,7 +21,12 @@ def run_in_transaction? if RSpec.configuration.use_active_record? include Fixtures - self.fixture_path = RSpec.configuration.fixture_path + # TestFixtures#fixture_path is deprecated and will be removed in Rails 7.2 + if respond_to?(:fixture_paths=) + fixture_paths << RSpec.configuration.fixture_path + else + self.fixture_path = RSpec.configuration.fixture_path + end self.use_transactional_tests = RSpec.configuration.use_transactional_fixtures self.use_instantiated_fixtures = RSpec.configuration.use_instantiated_fixtures diff --git a/spec/rspec/rails/configuration_spec.rb b/spec/rspec/rails/configuration_spec.rb index 0d14912f1..6705e299c 100644 --- a/spec/rspec/rails/configuration_spec.rb +++ b/spec/rspec/rails/configuration_spec.rb @@ -164,8 +164,14 @@ def in_inferring_type_from_location_environment group = RSpec.describe("Arbitrary Description", :use_fixtures) - expect(group).to respond_to(:fixture_path) - expect(group.fixture_path).to eq("custom/path") + if ::Rails::VERSION::MAJOR < 7 + expect(group).to respond_to(:fixture_path) + expect(group.fixture_path).to eq("custom/path") + else + expect(group).to respond_to(:fixture_paths) + expect(group.fixture_paths).to include("custom/path") + end + expect(group.new.respond_to?(:foo, true)).to be(true) end end From 9006484c4d77172498a232eccc3f95949d0ff7a7 Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Wed, 19 Apr 2023 01:09:08 +0300 Subject: [PATCH 2/2] Update spec/rspec/rails/configuration_spec.rb --- spec/rspec/rails/configuration_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/rspec/rails/configuration_spec.rb b/spec/rspec/rails/configuration_spec.rb index 6705e299c..e38e6e801 100644 --- a/spec/rspec/rails/configuration_spec.rb +++ b/spec/rspec/rails/configuration_spec.rb @@ -164,7 +164,7 @@ def in_inferring_type_from_location_environment group = RSpec.describe("Arbitrary Description", :use_fixtures) - if ::Rails::VERSION::MAJOR < 7 + if ::Rails::VERSION::STRING < '7.1.0' expect(group).to respond_to(:fixture_path) expect(group.fixture_path).to eq("custom/path") else