Skip to content

Commit

Permalink
Cut 0.28.0
Browse files Browse the repository at this point in the history
  • Loading branch information
koic committed Feb 20, 2023
1 parent 784d5dd commit bec6735
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

## master (unreleased)

## 0.28.0 (2023-02-20)

### New features

* [#214](https://github.com/rubocop/rubocop-minitest/issues/214): Add new `Minitest/LifecycleHooksOrder` cop. ([@fatkodima][])
Expand Down
2 changes: 1 addition & 1 deletion config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ Minitest/LifecycleHooksOrder:
Description: 'Checks that lifecycle hooks are declared in the order in which they will be executed.'
StyleGuide: 'https://minitest.rubystyle.guide/#hooks-ordering'
Enabled: pending
VersionAdded: '<<next>>'
VersionAdded: '0.28'

Minitest/LiteralAsActualArgument:
Description: 'This cop enforces correct order of `expected` and `actual` arguments for `assert_equal`.'
Expand Down
2 changes: 1 addition & 1 deletion docs/antora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ name: rubocop-minitest
title: RuboCop Minitest
# We always provide version without patch here (e.g. 1.1),
# as patch versions should not appear in the docs.
version: ~
version: '0.28'
nav:
- modules/ROOT/nav.adoc
1 change: 1 addition & 0 deletions docs/modules/ROOT/pages/cops.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ based on the https://minitest.rubystyle.guide/[Minitest Style Guide].
* xref:cops_minitest.adoc#minitestduplicatetestrun[Minitest/DuplicateTestRun]
* xref:cops_minitest.adoc#minitestemptylinebeforeassertionmethods[Minitest/EmptyLineBeforeAssertionMethods]
* xref:cops_minitest.adoc#minitestglobalexpectations[Minitest/GlobalExpectations]
* xref:cops_minitest.adoc#minitestlifecyclehooksorder[Minitest/LifecycleHooksOrder]
* xref:cops_minitest.adoc#minitestliteralasactualargument[Minitest/LiteralAsActualArgument]
* xref:cops_minitest.adoc#minitestmultipleassertions[Minitest/MultipleAssertions]
* xref:cops_minitest.adoc#minitestnoassertions[Minitest/NoAssertions]
Expand Down
64 changes: 64 additions & 0 deletions docs/modules/ROOT/pages/cops_minitest.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ instead of using `assert(matcher.match(string))`.
----
# bad
assert(matcher.match(string))
assert(matcher.match?(string))
assert(matcher =~ string)
assert(matcher.match(string), 'message')
# good
Expand Down Expand Up @@ -903,6 +905,66 @@ value { musts }.must_raise TypeError

* https://minitest.rubystyle.guide#global-expectations

== Minitest/LifecycleHooksOrder

|===
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed

| Pending
| Yes
| Yes
| 0.28
| -
|===

Checks that lifecycle hooks are declared in the order in which they will be executed.

=== Examples

[source,ruby]
----
# bad
class FooTest < Minitest::Test
def teardown; end
def setup; end
end
# good
class FooTest < Minitest::Test
def setup; end
def teardown; end
end
# bad (after test cases)
class FooTest < Minitest::Test
def test_something
assert foo
end
def setup; end
def teardown; end
end
# good
class FooTest < Minitest::Test
def setup; end
def teardown; end
def test_something
assert foo
end
end
# good (after non test case methods)
class FooTest < Minitest::Test
def do_something; end
def setup; end
def teardown; end
end
----

=== References

* https://minitest.rubystyle.guide/#hooks-ordering

== Minitest/LiteralAsActualArgument

|===
Expand Down Expand Up @@ -1337,6 +1399,8 @@ instead of using `refute(matcher.match(string))`.
----
# bad
refute(matcher.match(string))
refute(matcher.match?(string))
refute(matcher =~ string)
refute(matcher.match(string), 'message')
# good
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/minitest/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module RuboCop
module Minitest
# This module holds the RuboCop Minitest version information.
module Version
STRING = '0.27.0'
STRING = '0.28.0'

def self.document_version
STRING.match('\d+\.\d+').to_s
Expand Down
9 changes: 9 additions & 0 deletions relnotes/v0.28.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
### New features

* [#214](https://github.com/rubocop/rubocop-minitest/issues/214): Add new `Minitest/LifecycleHooksOrder` cop. ([@fatkodima][])

### Changes

* [#239](https://github.com/rubocop/rubocop-minitest/issues/239): Enhance `AssertMatch`/`RefuteMatch` to check `match?` and `=~` methods. ([@fatkodima][])

[@fatkodima]: https://github.com/fatkodima

0 comments on commit bec6735

Please sign in to comment.