Skip to content

Commit c81b279

Browse files
bfadpirj
authored andcommitted
Remove RSpecRails/InferredSpecType
At the time this cop was added, [it was noted][PR Comment] that this was legacy behavior left as the default for people migrating to RSpec 3. Now RSpec 7.1.0 has [removed this default][PR] to make it clear that this is deprecated / legacy behavior, let's delete this cop. [PR Comment]: rubocop/rubocop-rspec#1365 (comment) [PR]: rspec/rspec-rails#2804
1 parent fcf70fa commit c81b279

File tree

7 files changed

+2
-401
lines changed

7 files changed

+2
-401
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Master (Unreleased)
44

55
- Handle unknown HTTP status codes for `RSpecRails/HttpStatus` cop. ([@viralpraxis])
6+
- Remove `RSpecRails/InferredSpecType` now that it is clearly legacy / deprecated behavior. ([@bfad])
67

78
## 2.30.0 (2024-06-12)
89

@@ -72,6 +73,7 @@
7273

7374
[@akiomik]: https://github.com/akiomik
7475
[@anthony-robin]: https://github.com/anthony-robin
76+
[@bfad]: https://github.com/bfad
7577
[@bquorning]: https://github.com/bquorning
7678
[@corydiamand]: https://github.com/corydiamand
7779
[@g-rath]: https://github.com/G-Rath

config/default.yml

-23
Original file line numberDiff line numberDiff line change
@@ -35,29 +35,6 @@ RSpecRails/HttpStatus:
3535
VersionChanged: '2.20'
3636
Reference: https://www.rubydoc.info/gems/rubocop-rspec_rails/RuboCop/Cop/RSpecRails/HttpStatus
3737

38-
RSpecRails/InferredSpecType:
39-
Description: Identifies redundant spec type.
40-
Enabled: pending
41-
Safe: false
42-
VersionAdded: '2.14'
43-
Reference: https://www.rubydoc.info/gems/rubocop-rspec_rails/RuboCop/Cop/RSpecRails/InferredSpecType
44-
Inferences:
45-
channels: channel
46-
controllers: controller
47-
features: feature
48-
generator: generator
49-
helpers: helper
50-
jobs: job
51-
mailboxes: mailbox
52-
mailers: mailer
53-
models: model
54-
requests: request
55-
integration: request
56-
api: request
57-
routing: routing
58-
system: system
59-
views: view
60-
6138
RSpecRails/MinitestAssertions:
6239
Description: Check if using Minitest-like matchers.
6340
Enabled: pending

docs/modules/ROOT/pages/cops.adoc

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
* xref:cops_rspecrails.adoc#rspecrailsavoidsetuphook[RSpecRails/AvoidSetupHook]
66
* xref:cops_rspecrails.adoc#rspecrailshavehttpstatus[RSpecRails/HaveHttpStatus]
77
* xref:cops_rspecrails.adoc#rspecrailshttpstatus[RSpecRails/HttpStatus]
8-
* xref:cops_rspecrails.adoc#rspecrailsinferredspectype[RSpecRails/InferredSpecType]
98
* xref:cops_rspecrails.adoc#rspecrailsminitestassertions[RSpecRails/MinitestAssertions]
109
* xref:cops_rspecrails.adoc#rspecrailsnegationbevalid[RSpecRails/NegationBeValid]
1110
* xref:cops_rspecrails.adoc#rspecrailstravelaround[RSpecRails/TravelAround]

docs/modules/ROOT/pages/cops_rspecrails.adoc

-89
Original file line numberDiff line numberDiff line change
@@ -211,95 +211,6 @@ it { is_expected.to have_http_status :ok }
211211
212212
* https://www.rubydoc.info/gems/rubocop-rspec_rails/RuboCop/Cop/RSpecRails/HttpStatus
213213
214-
[#rspecrailsinferredspectype]
215-
== RSpecRails/InferredSpecType
216-
217-
|===
218-
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed
219-
220-
| Pending
221-
| No
222-
| Always (Unsafe)
223-
| 2.14
224-
| -
225-
|===
226-
227-
Identifies redundant spec type.
228-
229-
After setting up rspec-rails, you will have enabled
230-
`config.infer_spec_type_from_file_location!` by default in
231-
spec/rails_helper.rb. This cop works in conjunction with this config.
232-
If you disable this config, disable this cop as well.
233-
234-
[#safety-rspecrailsinferredspectype]
235-
=== Safety
236-
237-
This cop is marked as unsafe because
238-
`config.infer_spec_type_from_file_location!` may not be enabled.
239-
240-
[#examples-rspecrailsinferredspectype]
241-
=== Examples
242-
243-
[source,ruby]
244-
----
245-
# bad
246-
# spec/models/user_spec.rb
247-
RSpec.describe User, type: :model do
248-
end
249-
250-
# good
251-
# spec/models/user_spec.rb
252-
RSpec.describe User do
253-
end
254-
255-
# good
256-
# spec/models/user_spec.rb
257-
RSpec.describe User, type: :common do
258-
end
259-
----
260-
261-
[#_inferences_-configuration-rspecrailsinferredspectype]
262-
==== `Inferences` configuration
263-
264-
[source,ruby]
265-
----
266-
# .rubocop.yml
267-
# RSpecRails/InferredSpecType:
268-
# Inferences:
269-
# services: service
270-
271-
# bad
272-
# spec/services/user_spec.rb
273-
RSpec.describe User, type: :service do
274-
end
275-
276-
# good
277-
# spec/services/user_spec.rb
278-
RSpec.describe User do
279-
end
280-
281-
# good
282-
# spec/services/user_spec.rb
283-
RSpec.describe User, type: :common do
284-
end
285-
----
286-
287-
[#configurable-attributes-rspecrailsinferredspectype]
288-
=== Configurable attributes
289-
290-
|===
291-
| Name | Default value | Configurable values
292-
293-
| Inferences
294-
| `{"channels"=>"channel", "controllers"=>"controller", "features"=>"feature", "generator"=>"generator", "helpers"=>"helper", "jobs"=>"job", "mailboxes"=>"mailbox", "mailers"=>"mailer", "models"=>"model", "requests"=>"request", "integration"=>"request", "api"=>"request", "routing"=>"routing", "system"=>"system", "views"=>"view"}`
295-
|
296-
|===
297-
298-
[#references-rspecrailsinferredspectype]
299-
=== References
300-
301-
* https://www.rubydoc.info/gems/rubocop-rspec_rails/RuboCop/Cop/RSpecRails/InferredSpecType
302-
303214
[#rspecrailsminitestassertions]
304215
== RSpecRails/MinitestAssertions
305216

lib/rubocop/cop/rspec_rails/inferred_spec_type.rb

-143
This file was deleted.

lib/rubocop/cop/rspec_rails_cops.rb

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
require_relative 'rspec_rails/avoid_setup_hook'
44
require_relative 'rspec_rails/have_http_status'
55
require_relative 'rspec_rails/http_status'
6-
require_relative 'rspec_rails/inferred_spec_type'
76
require_relative 'rspec_rails/minitest_assertions'
87
require_relative 'rspec_rails/negation_be_valid'
98
require_relative 'rspec_rails/travel_around'

0 commit comments

Comments
 (0)