Skip to content

Commit a35a2d0

Browse files
committed
Fix an issue where TestFixtures#fixture_path was returning an array. It is deprecated, but it should still return a string until it is removed. So, if multiple fixture_paths are configured, it just returns the first path.
1 parent 995768e commit a35a2d0

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

activerecord/lib/active_record/test_fixtures.rb

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,12 @@ def set_fixture_class(class_names = {})
4343
end
4444

4545
def fixture_path
46-
ActiveRecord.deprecator.warn("TestFixtures#fixture_path is deprecated and will be removed in Rails 7.2. Use #fixture_paths instead.")
47-
fixture_paths
46+
ActiveRecord.deprecator.warn(<<~WARNING)
47+
TestFixtures#fixture_path is deprecated and will be removed in Rails 7.2. Use #fixture_paths instead.
48+
If multiple fixture paths have been configured with #fixture_paths, then #fixture_path will just return
49+
the first path.
50+
WARNING
51+
fixture_paths.first
4852
end
4953

5054
def fixture_path=(path)
@@ -96,8 +100,12 @@ def uses_transaction?(method)
96100
end
97101

98102
def fixture_path
99-
ActiveRecord.deprecator.warn("TestFixtures#fixture_path is deprecated and will be removed in Rails 7.2. Use #fixture_paths instead.")
100-
fixture_paths
103+
ActiveRecord.deprecator.warn(<<~WARNING)
104+
TestFixtures#fixture_path is deprecated and will be removed in Rails 7.2. Use #fixture_paths instead.
105+
If multiple fixture paths have been configured with #fixture_paths, then #fixture_path will just return
106+
the first path.
107+
WARNING
108+
fixture_paths.first
101109
end
102110

103111
def run_in_transaction?

0 commit comments

Comments
 (0)