@@ -6,21 +6,42 @@ module FixtureFileUploadSupport
66
77 private
88
9- def rails_fixture_file_wrapper
10- RailsFixtureFileWrapper . fixture_path = nil
11- resolved_fixture_path =
12- if respond_to? ( :fixture_path ) && !fixture_path . nil?
13- fixture_path . to_s
14- else
15- ( RSpec . configuration . fixture_path || '' ) . to_s
16- end
17- RailsFixtureFileWrapper . fixture_path = File . join ( resolved_fixture_path , '' ) unless resolved_fixture_path . strip . empty?
18- RailsFixtureFileWrapper . instance
9+ # In Rails 6.2 fixture file path needs to be relative to `file_fixture_path` instead, this change
10+ # was brought in with a deprecation warning on 6.1. In Rails 6.2 expect to rework this to remove
11+ # the old accessor.
12+ if ::Rails . version . to_f >= 6.1
13+ def rails_fixture_file_wrapper
14+ RailsFixtureFileWrapper . file_fixture_path = nil
15+ resolved_fixture_path =
16+ if respond_to? ( :file_fixture_path ) && !file_fixture_path . nil?
17+ file_fixture_path . to_s
18+ else
19+ ( RSpec . configuration . fixture_path || '' ) . to_s
20+ end
21+ RailsFixtureFileWrapper . file_fixture_path = File . join ( resolved_fixture_path , '' ) unless resolved_fixture_path . strip . empty?
22+ RailsFixtureFileWrapper . instance
23+ end
24+ else
25+ def rails_fixture_file_wrapper
26+ RailsFixtureFileWrapper . fixture_path = nil
27+ resolved_fixture_path =
28+ if respond_to? ( :fixture_path ) && !fixture_path . nil?
29+ fixture_path . to_s
30+ else
31+ ( RSpec . configuration . fixture_path || '' ) . to_s
32+ end
33+ RailsFixtureFileWrapper . fixture_path = File . join ( resolved_fixture_path , '' ) unless resolved_fixture_path . strip . empty?
34+ RailsFixtureFileWrapper . instance
35+ end
1936 end
2037
2138 class RailsFixtureFileWrapper
2239 include ActionDispatch ::TestProcess if defined? ( ActionDispatch ::TestProcess )
2340
41+ if ::Rails . version . to_f >= 6.1
42+ include ActiveSupport ::Testing ::FileFixtures
43+ end
44+
2445 class << self
2546 attr_accessor :fixture_path
2647
0 commit comments