1
1
module RSpec ::Rails
2
2
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
7
14
end
8
15
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
12
20
end
13
- end
14
21
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
18
27
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
20
34
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
25
52
end
26
53
end
27
54
@@ -31,11 +58,11 @@ def expect_to_pass(group)
31
58
expect ( result ) . to be true
32
59
end
33
60
34
- def fixture_file_upload_resolved ( fixture_name , fixture_path = nil )
61
+ def fixture_file_upload_resolved ( fixture_name , file_fixture_path = nil )
35
62
RSpec ::Core ::ExampleGroup . describe do
36
63
include RSpec ::Rails ::FixtureFileUploadSupport
37
64
38
- self . file_fixture_path = fixture_path
65
+ self . file_fixture_path = file_fixture_path
39
66
40
67
it 'supports fixture file upload' do
41
68
file = fixture_file_upload ( fixture_name )
0 commit comments