diff --git a/CHANGELOG.md b/CHANGELOG.md index b983cb2a3..a8de0a471 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,19 +2,13 @@ ## Master (Unreleased) +## 2.27.0 (2024-03-01) + - Add new `RSpec/IsExpectedSpecify` cop. ([@ydah]) -- Add support for `assert_true` and `assert_false` to `RSpec/Rails/MinitestAssertions`. ([@ydah]) +- Add new `RSpec/RepeatedSubjectCall` cop. ([@drcapulet]) +- Add support for `assert_true`, `assert_false`, `assert_not_equal`, `assert_not_nil`, `*_empty`, `*_predicate`, `*_kind_of`, `*_in_delta`, `*_match`, `*_instance_of` and `*_includes` assertions in `RSpec/Rails/MinitestAssertions`. ([@ydah], [@G-Rath]) - Support asserts with messages in `Rspec/BeEmpty`. ([@G-Rath]) -- Add support for `assert_empty`, `assert_not_empty` and `refute_empty` to `RSpec/Rails/MinitestAssertions`. ([@ydah]) -- Support correcting some `*_predicate` assertions in `RSpec/Rails/MinitestAssertions`. ([@G-Rath]) -- Support correcting `*_kind_of` assertions in `RSpec/Rails/MinitestAssertions`. ([@G-Rath]) -- Support correcting `*_in_delta` assertions in `RSpec/Rails/MinitestAssertions`. ([@G-Rath]) -- Support correcting `*_match` assertions in `RSpec/Rails/MinitestAssertions`. ([@G-Rath]) -- Support correcting `*_instance_of` assertions in `RSpec/Rails/MinitestAssertions`. ([@G-Rath]) -- Support correcting `*_includes` assertions in `RSpec/Rails/MinitestAssertions`. ([@G-Rath]) -- Support correcting `assert_not_equal` and `assert_not_nil` in `RSpec/Rails/MinitestAssertions`. ([@G-Rath]) - Fix a false positive for `RSpec/ExpectActual` when used with rspec-rails routing matchers. ([@naveg]) -- Add new `RSpec/RepeatedSubjectCall` cop. ([@drcapulet]) - Add configuration option `ResponseMethods` to `RSpec/Rails/HaveHttpStatus`. ([@ydah]) - Fix a false negative for `RSpec/DescribedClass` when class with constant. ([@ydah]) - Fix a false positive for `RSpec/ExampleWithoutDescription` when `specify` with multi-line block and missing description. ([@ydah]) diff --git a/config/default.yml b/config/default.yml index 5333595db..5a1905e6e 100644 --- a/config/default.yml +++ b/config/default.yml @@ -551,7 +551,7 @@ RSpec/InstanceVariable: RSpec/IsExpectedSpecify: Description: Check for `specify` with `is_expected` and one-liner expectations. Enabled: pending - VersionAdded: "<>" + VersionAdded: '2.27' StyleGuide: https://rspec.rubystyle.guide/#it-and-specify Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IsExpectedSpecify @@ -823,7 +823,7 @@ RSpec/RepeatedIncludeExample: RSpec/RepeatedSubjectCall: Description: Checks for repeated calls to subject missing that it is memoized. Enabled: pending - VersionAdded: "<>" + VersionAdded: '2.27' Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedSubjectCall RSpec/ReturnFromStub: @@ -1144,7 +1144,7 @@ RSpec/Rails/HaveHttpStatus: - last_response SafeAutoCorrect: false VersionAdded: '2.12' - VersionChanged: "<>" + VersionChanged: '2.27' Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HaveHttpStatus RSpec/Rails/HttpStatus: diff --git a/docs/antora.yml b/docs/antora.yml index 51a533a15..edd1d19a9 100644 --- a/docs/antora.yml +++ b/docs/antora.yml @@ -1,5 +1,5 @@ name: rubocop-rspec title: RuboCop RSpec -version: ~ +version: '2.27' nav: - modules/ROOT/nav.adoc diff --git a/docs/modules/ROOT/pages/cops_rspec.adoc b/docs/modules/ROOT/pages/cops_rspec.adoc index f349685b8..a818c0d94 100644 --- a/docs/modules/ROOT/pages/cops_rspec.adoc +++ b/docs/modules/ROOT/pages/cops_rspec.adoc @@ -13,7 +13,7 @@ | Disabled | Yes -| Yes +| Always | 1.16 | - |=== @@ -46,7 +46,7 @@ let(:a) { b } | Disabled | Yes -| Yes +| Always | 1.16 | - |=== @@ -199,7 +199,7 @@ expect(foo).to be(true) | Pending | Yes -| Yes +| Always | 2.20 | - |=== @@ -229,7 +229,7 @@ expect(array).to be_empty | Pending | No -| Yes (Unsafe) +| Always (Unsafe) | 2.9.0 | 2.16 |=== @@ -270,7 +270,7 @@ expect(foo).to be(nil) | Enabled | No -| Yes (Unsafe) +| Always (Unsafe) | 1.7 | 2.16 |=== @@ -325,7 +325,7 @@ expect(foo).to be(nil) | Pending | Yes -| Yes +| Always | 2.9.0 | 2.10.0 |=== @@ -428,7 +428,7 @@ end | Pending | Yes -| Yes +| Always | 2.11 | 2.14 |=== @@ -518,7 +518,7 @@ expect { run } | Pending | Yes -| Yes +| Always | 2.13 | - |=== @@ -575,7 +575,7 @@ expect(object).to be_a_kind_of(String) | Pending | Yes -| Yes +| Always | 2.19 | - |=== @@ -611,7 +611,7 @@ it { is_expected.to contain_exactly(content, *array) } | Enabled | Yes -| Yes +| Always | 1.36 | - |=== @@ -885,7 +885,7 @@ end | Enabled | Yes -| Yes (Unsafe) +| Always (Unsafe) | 1.0 | 1.11 |=== @@ -1016,7 +1016,7 @@ end | Disabled | Yes -| Yes +| Always | 1.33 | - |=== @@ -1085,7 +1085,7 @@ end | Pending | Yes -| Yes +| Always | 2.16 | - |=== @@ -1114,7 +1114,7 @@ describe 'Something', :a | Enabled | Yes -| Yes (Unsafe) +| Always (Unsafe) | 1.7 | 2.13 |=== @@ -1168,7 +1168,7 @@ end | Enabled | Yes -| Yes +| Always | 1.39 | - |=== @@ -1208,7 +1208,7 @@ after(:all) { cleanup_feed } | Enabled | Yes -| Yes +| Always | 1.36 | - |=== @@ -1280,7 +1280,7 @@ end | Enabled | Yes -| Yes +| Always | 1.27 | - |=== @@ -1321,7 +1321,7 @@ end | Enabled | Yes -| Yes +| Always | 1.14 | - |=== @@ -1356,7 +1356,7 @@ it { does_something } | Enabled | Yes -| Yes +| Always | 1.27 | 2.13 |=== @@ -1438,7 +1438,7 @@ it { does_something } | Enabled | Yes -| Yes +| Always | 1.14 | - |=== @@ -1471,7 +1471,7 @@ let(:foo) { bar } | Pending | Yes -| Yes +| Always | 2.24 | - |=== @@ -1502,7 +1502,7 @@ describe 'Something' | Pending | Yes -| Yes +| Always | 2.24 | - |=== @@ -1714,7 +1714,7 @@ end | Enabled | Yes -| Yes +| Always | 1.0 | 2.13 |=== @@ -1802,7 +1802,7 @@ end | Pending | Yes -| Yes +| Always | 2.5 | - |=== @@ -1844,7 +1844,7 @@ end | Enabled | Yes -| Yes +| Always | 1.7 | 2.23 |=== @@ -1892,7 +1892,7 @@ expect(false).to eq(true) | Enabled | Yes -| Yes (Unsafe) +| Always (Unsafe) | 1.22 | 2.5 |=== @@ -2133,7 +2133,7 @@ my_class_spec.rb # describe MyClass, '#method' | Enabled | Yes -| Yes +| Always | 1.5 | 2.1 |=== @@ -2199,7 +2199,7 @@ focus 'test' do; end | Enabled | Yes -| Yes +| Always | 1.7 | - |=== @@ -2295,7 +2295,7 @@ end | Enabled | Yes -| Yes +| Always | 1.29 | - |=== @@ -2400,7 +2400,7 @@ end | Enabled | Yes -| Yes +| Always | 1.8 | - |=== @@ -2456,7 +2456,7 @@ it { should be_truthy } | Enabled | Yes -| Yes +| Always | 1.29 | 2.13 |=== @@ -2652,7 +2652,7 @@ let(:item_2) { create(:item) } | Enabled | Yes -| Yes +| Always | 1.12 | - |=== @@ -2764,8 +2764,8 @@ end | Pending | Yes -| Yes -| <> +| Always +| 2.27 | - |=== @@ -2800,7 +2800,7 @@ specify { expect(sqrt(4)).to eq(2) } | Enabled | Yes -| Yes +| Always | 1.13 | - |=== @@ -2885,7 +2885,7 @@ end | Enabled | Yes -| Yes +| Always | 1.7 | 1.14 |=== @@ -3050,7 +3050,7 @@ end | Enabled | Yes -| Yes +| Always | 1.16 | 1.22 |=== @@ -3141,7 +3141,7 @@ end | Pending | Yes -| Yes +| Always | 2.19 | - |=== @@ -3326,7 +3326,7 @@ do_something | Pending | Yes -| Yes +| Always | 2.24 | - |=== @@ -3689,7 +3689,7 @@ end | Enabled | Yes -| Yes +| Always | 1.16 | - |=== @@ -4094,7 +4094,7 @@ end | Enabled | Yes -| Yes +| Always | 1.4 | - |=== @@ -4316,7 +4316,7 @@ end | Enabled | Yes -| Yes (Unsafe) +| Always (Unsafe) | 1.16 | - |=== @@ -4418,7 +4418,7 @@ expect(foo.something?).to be_truthy | Enabled | Yes -| Yes +| Always | 1.26 | - |=== @@ -4457,7 +4457,7 @@ expect(foo).to receive(:bar).at_most(:twice).times | Pending | Yes -| Yes (Unsafe) +| Always (Unsafe) | 2.23 | - |=== @@ -4503,7 +4503,7 @@ end | Enabled | Yes -| Yes +| Always | 1.28 | - |=== @@ -4532,7 +4532,7 @@ expect(foo).not_to receive(:bar) | Pending | Yes -| Yes +| Always | 2.19 | - |=== @@ -4562,7 +4562,7 @@ end | Pending | Yes -| Yes +| Always | 2.26 | - |=== @@ -4895,7 +4895,7 @@ end | Pending | Yes | No -| <> +| 2.27 | - |=== @@ -4934,7 +4934,7 @@ end | Enabled | Yes -| Yes +| Always | 1.16 | 1.22 |=== @@ -5000,7 +5000,7 @@ allow(Foo).to receive(:bar).and_return(bar.baz) | Enabled | Yes -| Yes +| Always | 1.14 | 1.39 |=== @@ -5043,7 +5043,7 @@ end | Enabled | Yes -| Yes +| Always | 1.10 | - |=== @@ -5082,7 +5082,7 @@ end | Enabled | Yes -| Yes +| Always | 1.13 | - |=== @@ -5151,7 +5151,7 @@ end | Enabled | Yes -| Yes +| Always | 1.25 | 2.26 |=== @@ -5223,7 +5223,7 @@ include_examples :foo_bar_baz | Enabled | Yes -| Yes +| Always | 1.9 | 1.10 |=== @@ -5296,7 +5296,7 @@ end | Pending | Yes -| Yes +| Always | 2.14 | - |=== @@ -5639,7 +5639,7 @@ expect { do_something }.not_to raise_error | Enabled | Yes -| Yes +| Always | 1.40 | - |=== @@ -5776,7 +5776,7 @@ let(:userFood_2) { 'fettuccine' } | Pending | Yes -| Yes (Unsafe) +| Always (Unsafe) | 2.10.0 | 2.12 |=== @@ -5935,7 +5935,7 @@ expect(something).to be(1) | Enabled | Yes -| Yes +| Always | 1.32 | - |=== diff --git a/docs/modules/ROOT/pages/cops_rspec_capybara.adoc b/docs/modules/ROOT/pages/cops_rspec_capybara.adoc index 880063340..937c34cea 100644 --- a/docs/modules/ROOT/pages/cops_rspec_capybara.adoc +++ b/docs/modules/ROOT/pages/cops_rspec_capybara.adoc @@ -13,7 +13,7 @@ | Enabled | Yes -| Yes +| Always | 1.18 | 2.0 |=== @@ -58,7 +58,7 @@ expect(page).to have_current_path('/callback') | Enabled | Yes -| Yes +| Always | 1.17 | 2.0 |=== @@ -125,7 +125,7 @@ end | Pending | Yes -| Yes +| Always | 2.17 | - |=== @@ -180,7 +180,7 @@ expect(page).to match_style(display: 'block') | Pending | Yes -| Yes +| Always | 2.14 | - |=== @@ -271,7 +271,7 @@ find('div').click_button | Pending | Yes -| Yes +| Always | 2.13 | - |=== diff --git a/docs/modules/ROOT/pages/cops_rspec_factorybot.adoc b/docs/modules/ROOT/pages/cops_rspec_factorybot.adoc index e39adfdd5..580edbb3a 100644 --- a/docs/modules/ROOT/pages/cops_rspec_factorybot.adoc +++ b/docs/modules/ROOT/pages/cops_rspec_factorybot.adoc @@ -13,7 +13,7 @@ | Enabled | Yes -| Yes +| Always | 1.28 | 2.23 |=== @@ -64,7 +64,7 @@ count { 1 } | Pending | Yes -| Yes +| Always | 2.14 | - |=== @@ -135,7 +135,7 @@ build( | Enabled | Yes -| Yes +| Always | 1.25 | 2.23 |=== @@ -202,7 +202,7 @@ create_list :user, 3 | Enabled | Yes -| Yes +| Always | 1.37 | 2.23 |=== @@ -248,7 +248,7 @@ end | Pending | Yes -| Yes +| Always | 2.16 | - |=== @@ -304,7 +304,7 @@ build "user", username: "NAME" | Pending | Yes -| Yes (Unsafe) +| Always (Unsafe) | 2.7 | - |=== diff --git a/docs/modules/ROOT/pages/cops_rspec_rails.adoc b/docs/modules/ROOT/pages/cops_rspec_rails.adoc index a6579ab0f..b956d2991 100644 --- a/docs/modules/ROOT/pages/cops_rspec_rails.adoc +++ b/docs/modules/ROOT/pages/cops_rspec_rails.adoc @@ -13,7 +13,7 @@ | Pending | Yes -| Yes +| Always | 2.4 | - |=== @@ -46,9 +46,9 @@ end | Pending | Yes -| Yes (Unsafe) +| Always (Unsafe) | 2.12 -| <> +| 2.27 |=== Checks that tests use `have_http_status` instead of equality matchers. @@ -104,7 +104,7 @@ expect(last_response).to have_http_status(200) | Enabled | Yes -| Yes +| Always | 1.23 | 2.20 |=== @@ -192,7 +192,7 @@ it { is_expected.to have_http_status :error } | Pending | No -| Yes (Unsafe) +| Always (Unsafe) | 2.14 | - |=== @@ -275,7 +275,7 @@ end | Pending | Yes -| Yes +| Always | 2.17 | - |=== @@ -321,7 +321,7 @@ expect(a).to be(false) | Pending | No -| Yes (Unsafe) +| Always (Unsafe) | 2.23 | - |=== @@ -384,7 +384,7 @@ expect(foo).to be_invalid.or be_even | Pending | No -| Yes (Unsafe) +| Always (Unsafe) | 2.19 | - |=== diff --git a/lib/rubocop/rspec/version.rb b/lib/rubocop/rspec/version.rb index 6320853d4..20d9f952c 100644 --- a/lib/rubocop/rspec/version.rb +++ b/lib/rubocop/rspec/version.rb @@ -4,7 +4,7 @@ module RuboCop module RSpec # Version information for the RSpec RuboCop plugin. module Version - STRING = '2.26.1' + STRING = '2.27.0' end end end