11module RSpec ::Rails
22 RSpec . describe FixtureFileUploadSupport do
3- context 'with fixture path set in config' do
4- it 'resolves fixture file' do
5- RSpec . configuration . fixture_path = File . dirname ( __FILE__ )
6- expect_to_pass fixture_file_upload_resolved ( 'fixture_file_upload_support_spec.rb' )
3+ if ::Rails ::VERSION ::STRING < "7.1.0"
4+ context 'with fixture path set in config' do
5+ it 'resolves fixture file' do
6+ RSpec . configuration . fixture_path = File . dirname ( __FILE__ )
7+ expect_to_pass fixture_file_upload_resolved ( 'fixture_file_upload_support_spec.rb' )
8+ end
9+
10+ it 'resolves supports `Pathname` objects' do
11+ RSpec . configuration . fixture_path = Pathname ( File . dirname ( __FILE__ ) )
12+ expect_to_pass fixture_file_upload_resolved ( 'fixture_file_upload_support_spec.rb' )
13+ end
714 end
815
9- it 'resolves supports `Pathname` objects' do
10- RSpec . configuration . fixture_path = Pathname ( File . dirname ( __FILE__ ) )
11- expect_to_pass fixture_file_upload_resolved ( 'fixture_file_upload_support_spec.rb' )
16+ context 'with fixture path set in spec' do
17+ it 'resolves fixture file' do
18+ expect_to_pass fixture_file_upload_resolved ( 'fixture_file_upload_support_spec.rb' , File . dirname ( __FILE__ ) )
19+ end
1220 end
13- end
1421
15- context 'with fixture path set in spec' do
16- it 'resolves fixture file' do
17- expect_to_pass fixture_file_upload_resolved ( 'fixture_file_upload_support_spec.rb' , File . dirname ( __FILE__ ) )
22+ context 'with fixture path not set' do
23+ it 'resolves fixture using relative path' do
24+ RSpec . configuration . fixture_path = nil
25+ expect_to_pass fixture_file_upload_resolved ( 'spec/rspec/rails/fixture_file_upload_support_spec.rb' )
26+ end
1827 end
19- end
28+ else
29+ context 'with fixture paths set in config' do
30+ it 'resolves fixture file' do
31+ RSpec . configuration . fixture_paths = [ File . dirname ( __FILE__ ) ]
32+ expect_to_pass fixture_file_upload_resolved ( 'fixture_file_upload_support_spec.rb' )
33+ end
2034
21- context 'with fixture path not set' do
22- it 'resolves fixture using relative path' do
23- RSpec . configuration . fixture_path = nil
24- expect_to_pass fixture_file_upload_resolved ( 'spec/rspec/rails/fixture_file_upload_support_spec.rb' )
35+ it 'resolves supports `Pathname` objects' do
36+ RSpec . configuration . fixture_paths = [ Pathname ( File . dirname ( __FILE__ ) ) ]
37+ expect_to_pass fixture_file_upload_resolved ( 'fixture_file_upload_support_spec.rb' )
38+ end
39+ end
40+
41+ context 'with fixture path set in spec' do
42+ it 'resolves fixture file' do
43+ expect_to_pass fixture_file_upload_resolved ( 'fixture_file_upload_support_spec.rb' , File . dirname ( __FILE__ ) )
44+ end
45+ end
46+
47+ context 'with fixture path not set' do
48+ it 'resolves fixture using relative path' do
49+ RSpec . configuration . fixture_path = nil
50+ expect_to_pass fixture_file_upload_resolved ( 'spec/rspec/rails/fixture_file_upload_support_spec.rb' )
51+ end
2552 end
2653 end
2754
@@ -31,11 +58,11 @@ def expect_to_pass(group)
3158 expect ( result ) . to be true
3259 end
3360
34- def fixture_file_upload_resolved ( fixture_name , fixture_path = nil )
61+ def fixture_file_upload_resolved ( fixture_name , file_fixture_path = nil )
3562 RSpec ::Core ::ExampleGroup . describe do
3663 include RSpec ::Rails ::FixtureFileUploadSupport
3764
38- self . file_fixture_path = fixture_path
65+ self . file_fixture_path = file_fixture_path
3966
4067 it 'supports fixture file upload' do
4168 file = fixture_file_upload ( fixture_name )
0 commit comments