Skip to content

Remove RSpecRails/InferredSpecType #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
89 changes: 0 additions & 89 deletions docs/modules/ROOT/pages/cops_rspecrails.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -211,95 +211,6 @@ it { is_expected.to have_http_status :ok }

* https://www.rubydoc.info/gems/rubocop-rspec_rails/RuboCop/Cop/RSpecRails/HttpStatus

[#rspecrailsinferredspectype]
== 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-rspecrailsinferredspectype]
=== Safety

This cop is marked as unsafe because
`config.infer_spec_type_from_file_location!` may not be enabled.

[#examples-rspecrailsinferredspectype]
=== 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-rspecrailsinferredspectype]
==== `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-rspecrailsinferredspectype]
=== 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-rspecrailsinferredspectype]
=== References

* https://www.rubydoc.info/gems/rubocop-rspec_rails/RuboCop/Cop/RSpecRails/InferredSpecType

[#rspecrailsminitestassertions]
== 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