1
- # rubocop: disable Metrics/ModuleLength
2
1
module RSpec
3
2
module Rails
4
3
# Fake class to document RSpec Rails configuration options. In practice,
@@ -57,7 +56,7 @@ def self.add_test_type_configurations(config)
57
56
end
58
57
59
58
# @private
60
- def self . initialize_configuration ( config ) # rubocop:disable Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/AbcSize,Metrics/PerceivedComplexity
59
+ def self . initialize_configuration ( config ) # rubocop:disable Metrics/MethodLength
61
60
config . backtrace_exclusion_patterns << /vendor\/ /
62
61
config . backtrace_exclusion_patterns << %r{lib/rspec/rails}
63
62
@@ -69,12 +68,7 @@ def self.initialize_configuration(config) # rubocop:disable Metrics/MethodLength
69
68
config . add_setting :use_transactional_fixtures , alias_with : :use_transactional_examples
70
69
config . add_setting :use_instantiated_fixtures
71
70
config . add_setting :global_fixtures
72
-
73
- if ::Rails ::VERSION ::STRING < "7.1.0"
74
- config . add_setting :fixture_path
75
- else
76
- config . add_setting :fixture_paths
77
- end
71
+ config . add_setting :fixture_paths
78
72
79
73
config . include RSpec ::Rails ::FixtureSupport , :use_fixtures
80
74
@@ -90,7 +84,7 @@ def self.initialize_configuration(config) # rubocop:disable Metrics/MethodLength
90
84
config . add_setting :file_fixture_path , default : 'spec/fixtures/files'
91
85
config . include RSpec ::Rails ::FileFixtureSupport
92
86
93
- # Add support for fixture_path on fixture_file_upload
87
+ # Add support for fixture_paths on fixture_file_upload
94
88
config . include RSpec ::Rails ::FixtureFileUploadSupport
95
89
96
90
# This allows us to expose `render_views` as a config option even though it
@@ -114,40 +108,6 @@ def render_views?
114
108
rendering_views?
115
109
end
116
110
117
- undef :rendering_views? if respond_to? ( :rendering_views? )
118
- def rendering_views?
119
- !!rendering_views
120
- end
121
-
122
- # Define boolean predicates rather than relying on rspec-core due
123
- # to the bug fix in rspec/rspec-core#2736, note some of these
124
- # predicates are a bit nonsensical, but they exist for backwards
125
- # compatibility, we can tidy these up in `rspec-rails` 5.
126
- undef :fixture_path? if respond_to? ( :fixture_path? )
127
- def fixture_path?
128
- !!fixture_path
129
- end
130
-
131
- undef :global_fixtures? if respond_to? ( :global_fixtures? )
132
- def global_fixtures?
133
- !!global_fixtures
134
- end
135
-
136
- undef :infer_base_class_for_anonymous_controllers? if respond_to? ( :infer_base_class_for_anonymous_controllers? )
137
- def infer_base_class_for_anonymous_controllers?
138
- !!infer_base_class_for_anonymous_controllers
139
- end
140
-
141
- undef :use_instantiated_fixtures? if respond_to? ( :use_instantiated_fixtures? )
142
- def use_instantiated_fixtures?
143
- !!use_instantiated_fixtures
144
- end
145
-
146
- undef :use_transactional_fixtures? if respond_to? ( :use_transactional_fixtures? )
147
- def use_transactional_fixtures?
148
- !!use_transactional_fixtures
149
- end
150
-
151
111
def infer_spec_type_from_file_location!
152
112
DIRECTORY_MAPPINGS . each do |type , dir_parts |
153
113
escaped_path = Regexp . compile ( dir_parts . join ( '[\\\/]' ) + '[\\\/]' )
@@ -163,29 +123,6 @@ def filter_rails_from_backtrace!
163
123
filter_gems_from_backtrace "activemodel" , "activerecord" ,
164
124
"activesupport" , "activejob"
165
125
end
166
-
167
- # @deprecated TestFixtures#fixture_path is deprecated and will be removed in Rails 7.2
168
- if ::Rails ::VERSION ::STRING >= "7.1.0"
169
- def fixture_path
170
- RSpec . deprecate (
171
- "config.fixture_path" ,
172
- replacement : "config.fixture_paths" ,
173
- message : "Rails 7.1 has deprecated the singular fixture_path in favour of an array." \
174
- "You should migrate to plural:"
175
- )
176
- fixture_paths &.first
177
- end
178
-
179
- def fixture_path = ( path )
180
- RSpec . deprecate (
181
- "config.fixture_path = #{ path . inspect } " ,
182
- replacement : "config.fixture_paths = [#{ path . inspect } ]" ,
183
- message : "Rails 7.1 has deprecated the singular fixture_path in favour of an array." \
184
- "You should migrate to plural:"
185
- )
186
- self . fixture_paths = Array ( path )
187
- end
188
- end
189
126
end
190
127
191
128
add_test_type_configurations ( config )
@@ -219,4 +156,3 @@ def fixture_path=(path)
219
156
initialize_configuration RSpec . configuration
220
157
end
221
158
end
222
- # rubocop: enable Metrics/ModuleLength
0 commit comments