Skip to content

Commit 1a582da

Browse files
authored
Merge pull request #1666 from rubocop/feature/1658
Add new `RSpec/IsExpectedSpecify` cop
2 parents f92f39c + 28de064 commit 1a582da

File tree

5 files changed

+12
-0
lines changed

5 files changed

+12
-0
lines changed

.rubocop.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ RSpec/IdenticalEqualityAssertion:
165165
Enabled: true
166166
RSpec/IndexedLet:
167167
Enabled: true
168+
RSpec/IsExpectedSpecify:
169+
Enabled: true
168170
RSpec/MatchArray:
169171
Enabled: true
170172
RSpec/MetadataStyle:

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Master (Unreleased)
44

5+
- Add new `RSpec/IsExpectedSpecify` cop. ([@ydah])
56
- Add support for `assert_true` and `assert_false` to `RSpec/Rails/MinitestAssertions`. ([@ydah])
67
- Support asserts with messages in `Rspec/BeEmpty`. ([@G-Rath])
78
- Add support for `assert_empty`, `assert_not_empty` and `refute_empty` to `RSpec/Rails/MinitestAssertions`. ([@ydah])

config/default.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,13 @@ RSpec/InstanceVariable:
548548
StyleGuide: https://rspec.rubystyle.guide/#instance-variables
549549
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable
550550

551+
RSpec/IsExpectedSpecify:
552+
Description: Check for `specify` with `is_expected` and one-liner expectations.
553+
Enabled: pending
554+
VersionAdded: "<<next>>"
555+
StyleGuide: https://rspec.rubystyle.guide/#it-and-specify
556+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IsExpectedSpecify
557+
551558
RSpec/ItBehavesLike:
552559
Description: Checks that only one `it_behaves_like` style is used.
553560
Enabled: true

docs/modules/ROOT/pages/cops.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
* xref:cops_rspec.adoc#rspecindexedlet[RSpec/IndexedLet]
5353
* xref:cops_rspec.adoc#rspecinstancespy[RSpec/InstanceSpy]
5454
* xref:cops_rspec.adoc#rspecinstancevariable[RSpec/InstanceVariable]
55+
* xref:cops_rspec.adoc#rspecisexpectedspecify[RSpec/IsExpectedSpecify]
5556
* xref:cops_rspec.adoc#rspecitbehaveslike[RSpec/ItBehavesLike]
5657
* xref:cops_rspec.adoc#rspeciteratedexpectation[RSpec/IteratedExpectation]
5758
* xref:cops_rspec.adoc#rspecleadingsubject[RSpec/LeadingSubject]

lib/rubocop/cop/rspec_rails_cops.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
require_relative 'rspec/indexed_let'
7979
require_relative 'rspec/instance_spy'
8080
require_relative 'rspec/instance_variable'
81+
require_relative 'rspec/is_expected_specify'
8182
require_relative 'rspec/it_behaves_like'
8283
require_relative 'rspec/iterated_expectation'
8384
require_relative 'rspec/leading_subject'

0 commit comments

Comments
 (0)