Skip to content
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

Fix deprecated TestFixtures#fixture_path call #2664

Merged
merged 2 commits into from Apr 19, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/rspec/rails/fixture_support.rb
Expand Up @@ -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

Expand Down
10 changes: 8 additions & 2 deletions spec/rspec/rails/configuration_spec.rb
Expand Up @@ -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::STRING < '7.1.0'
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
Expand Down