Skip to content

Commit ddb9153

Browse files
committed
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 71d49a0 commit ddb9153

File tree

7 files changed

+1
-395
lines changed

7 files changed

+1
-395
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
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

config/default.yml

Lines changed: 0 additions & 23 deletions
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -195,89 +195,6 @@ it { is_expected.to have_http_status :ok }
195195
196196
* https://www.rubydoc.info/gems/rubocop-rspec_rails/RuboCop/Cop/RSpecRails/HttpStatus
197197
198-
== RSpecRails/InferredSpecType
199-
200-
|===
201-
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed
202-
203-
| Pending
204-
| No
205-
| Always (Unsafe)
206-
| 2.14
207-
| -
208-
|===
209-
210-
Identifies redundant spec type.
211-
212-
After setting up rspec-rails, you will have enabled
213-
`config.infer_spec_type_from_file_location!` by default in
214-
spec/rails_helper.rb. This cop works in conjunction with this config.
215-
If you disable this config, disable this cop as well.
216-
217-
=== Safety
218-
219-
This cop is marked as unsafe because
220-
`config.infer_spec_type_from_file_location!` may not be enabled.
221-
222-
=== Examples
223-
224-
[source,ruby]
225-
----
226-
# bad
227-
# spec/models/user_spec.rb
228-
RSpec.describe User, type: :model do
229-
end
230-
231-
# good
232-
# spec/models/user_spec.rb
233-
RSpec.describe User do
234-
end
235-
236-
# good
237-
# spec/models/user_spec.rb
238-
RSpec.describe User, type: :common do
239-
end
240-
----
241-
242-
==== `Inferences` configuration
243-
244-
[source,ruby]
245-
----
246-
# .rubocop.yml
247-
# RSpecRails/InferredSpecType:
248-
# Inferences:
249-
# services: service
250-
251-
# bad
252-
# spec/services/user_spec.rb
253-
RSpec.describe User, type: :service do
254-
end
255-
256-
# good
257-
# spec/services/user_spec.rb
258-
RSpec.describe User do
259-
end
260-
261-
# good
262-
# spec/services/user_spec.rb
263-
RSpec.describe User, type: :common do
264-
end
265-
----
266-
267-
=== Configurable attributes
268-
269-
|===
270-
| Name | Default value | Configurable values
271-
272-
| Inferences
273-
| `{"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"}`
274-
|
275-
|===
276-
277-
=== References
278-
279-
* https://www.rubydoc.info/gems/rubocop-rspec_rails/RuboCop/Cop/RSpecRails/InferredSpecType
280-
281198
== RSpecRails/MinitestAssertions
282199
283200
|===

lib/rubocop/cop/rspec_rails/inferred_spec_type.rb

Lines changed: 0 additions & 143 deletions
This file was deleted.

lib/rubocop/cop/rspec_rails_cops.rb

Lines changed: 0 additions & 1 deletion
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)