Skip to content

Commit

Permalink
Merge pull request #67 from koic/support_all_expectations_for_global_…
Browse files Browse the repository at this point in the history
…expectations

[Fix #66] Support all expectations of `Minitest::Expectations`
  • Loading branch information
koic committed Mar 15, 2020
2 parents 33fce84 + 6708594 commit 234cd53
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## master (unreleased)

### New features

* [#66](https://github.com/rubocop-hq/rubocop-minitest/issues/66): Support all expectations of `Minitest::Expectations` for `Minitest/GlobalExpectations` cop. ([@koic][])

### Bug fixes

* [#60](https://github.com/rubocop-hq/rubocop-minitest/issues/60): Fix `Minitest/GlobalExpectations` autocorrection for chained methods. ([@tejasbubane][])
Expand Down
15 changes: 8 additions & 7 deletions lib/rubocop/cop/minitest/global_expectations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ class GlobalExpectations < Cop
MSG = 'Prefer using `%<corrected>s`.'

VALUE_MATCHERS = %i[
be be_close_to be_empty be_instance_of be_kind_of
be_nil be_same_as be_silent be_within_epsilon equal
include match respond_to must_exist
].map do |matcher|
[:"must_#{matcher}", :"wont_#{matcher}"]
end.flatten.freeze
must_be_empty must_equal must_be_close_to must_be_within_delta
must_be_within_epsilon must_include must_be_instance_of must_be_kind_of
must_match must_be_nil must_be must_respond_to must_be_same_as
path_must_exist path_wont_exist wont_be_empty wont_equal wont_be_close_to
wont_be_within_delta wont_be_within_epsilon wont_include wont_be_instance_of
wont_be_kind_of wont_match wont_be_nil wont_be wont_respond_to wont_be_same_as
].freeze

BLOCK_MATCHERS = %i[must_output must_raise must_throw].freeze
BLOCK_MATCHERS = %i[must_output must_raise must_be_silent must_throw].freeze

MATCHERS_STR = (VALUE_MATCHERS + BLOCK_MATCHERS).map do |m|
":#{m}"
Expand Down

0 comments on commit 234cd53

Please sign in to comment.