Skip to content

Commit

Permalink
Remove RSpecRails/InferredSpecType
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bfad committed Nov 23, 2024
1 parent 71d49a0 commit 2330a11
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 395 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Master (Unreleased)

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

## 2.30.0 (2024-06-12)

Expand Down Expand Up @@ -72,6 +73,7 @@

[@akiomik]: https://github.com/akiomik
[@anthony-robin]: https://github.com/anthony-robin
[@bfad]: https://github.com/bfad
[@bquorning]: https://github.com/bquorning
[@corydiamand]: https://github.com/corydiamand
[@g-rath]: https://github.com/G-Rath
Expand Down
23 changes: 0 additions & 23 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,6 @@ RSpecRails/HttpStatus:
VersionChanged: '2.20'
Reference: https://www.rubydoc.info/gems/rubocop-rspec_rails/RuboCop/Cop/RSpecRails/HttpStatus

RSpecRails/InferredSpecType:
Description: Identifies redundant spec type.
Enabled: pending
Safe: false
VersionAdded: '2.14'
Reference: https://www.rubydoc.info/gems/rubocop-rspec_rails/RuboCop/Cop/RSpecRails/InferredSpecType
Inferences:
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

RSpecRails/MinitestAssertions:
Description: Check if using Minitest-like matchers.
Enabled: pending
Expand Down
1 change: 0 additions & 1 deletion docs/modules/ROOT/pages/cops.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* xref:cops_rspecrails.adoc#rspecrailsavoidsetuphook[RSpecRails/AvoidSetupHook]
* xref:cops_rspecrails.adoc#rspecrailshavehttpstatus[RSpecRails/HaveHttpStatus]
* xref:cops_rspecrails.adoc#rspecrailshttpstatus[RSpecRails/HttpStatus]
* xref:cops_rspecrails.adoc#rspecrailsinferredspectype[RSpecRails/InferredSpecType]
* xref:cops_rspecrails.adoc#rspecrailsminitestassertions[RSpecRails/MinitestAssertions]
* xref:cops_rspecrails.adoc#rspecrailsnegationbevalid[RSpecRails/NegationBeValid]
* xref:cops_rspecrails.adoc#rspecrailstravelaround[RSpecRails/TravelAround]
Expand Down
83 changes: 0 additions & 83 deletions docs/modules/ROOT/pages/cops_rspecrails.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -195,89 +195,6 @@ it { is_expected.to have_http_status :ok }
* https://www.rubydoc.info/gems/rubocop-rspec_rails/RuboCop/Cop/RSpecRails/HttpStatus
== RSpecRails/InferredSpecType
|===
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed
| Pending
| No
| Always (Unsafe)
| 2.14
| -
|===
Identifies redundant spec type.
After setting up rspec-rails, you will have enabled
`config.infer_spec_type_from_file_location!` by default in
spec/rails_helper.rb. This cop works in conjunction with this config.
If you disable this config, disable this cop as well.
=== Safety
This cop is marked as unsafe because
`config.infer_spec_type_from_file_location!` may not be enabled.
=== Examples
[source,ruby]
----
# bad
# spec/models/user_spec.rb
RSpec.describe User, type: :model do
end
# good
# spec/models/user_spec.rb
RSpec.describe User do
end
# good
# spec/models/user_spec.rb
RSpec.describe User, type: :common do
end
----
==== `Inferences` configuration
[source,ruby]
----
# .rubocop.yml
# RSpecRails/InferredSpecType:
# Inferences:
# services: service
# bad
# spec/services/user_spec.rb
RSpec.describe User, type: :service do
end
# good
# spec/services/user_spec.rb
RSpec.describe User do
end
# good
# spec/services/user_spec.rb
RSpec.describe User, type: :common do
end
----
=== Configurable attributes
|===
| Name | Default value | Configurable values
| Inferences
| `{"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"}`
|
|===
=== References
* https://www.rubydoc.info/gems/rubocop-rspec_rails/RuboCop/Cop/RSpecRails/InferredSpecType
== RSpecRails/MinitestAssertions
|===
Expand Down
143 changes: 0 additions & 143 deletions lib/rubocop/cop/rspec_rails/inferred_spec_type.rb

This file was deleted.

1 change: 0 additions & 1 deletion lib/rubocop/cop/rspec_rails_cops.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require_relative 'rspec_rails/avoid_setup_hook'
require_relative 'rspec_rails/have_http_status'
require_relative 'rspec_rails/http_status'
require_relative 'rspec_rails/inferred_spec_type'
require_relative 'rspec_rails/minitest_assertions'
require_relative 'rspec_rails/negation_be_valid'
require_relative 'rspec_rails/travel_around'
Loading

0 comments on commit 2330a11

Please sign in to comment.