Make the RuboCop::Minitest::Test suite re-usable by gem consumers#278
Make the RuboCop::Minitest::Test suite re-usable by gem consumers#278DougEdey wants to merge 1 commit intorubocop:masterfrom
Conversation
|
This makes a lot of sense to me and I'd love to use it. |
|
If this is being exposed like this then I think it needs some documetation on how to pass global and cop specific config to a test. See rubocop-minitest/test/rubocop/cop/minitest/global_expectations_test.rb Lines 504 to 513 in b446022 rubocop-minitest/test/rubocop/cop/minitest/multiple_assertions_test.rb Lines 339 to 343 in b446022 |
|
@Earlopain Updated the casing of |
5b0c5da to
949aa1d
Compare
|
Squashed commits and confirmed CI is passing locally |
|
@koic 👋 Could I ask for a review? |
|
@koic it's been a while, but I'd still like to get this merged |
|
It's been a while since I last looked at this and this may be a dumb question to only come now but can you explain why this is needed? Specifically I think there already exists what you are looking for: #155 and #156 https://github.com/rubocop/rubocop-minitest/blob/master/lib/rubocop/minitest/support.rb |
I've been writing custom cops for various jobs for a while now, but I've never had a consistent way to write tests for products that use minitest as the test suite (officially Rubocop only provides
rspechelpers) , I started to look around to see what this Gem did and figured it would make sense to makerubocop-minitestprovide a minitest class for others that write custom cops for their own code bases.This does a couple of things
Rubocop::Minitest::Testclass that includes the code fromassert_offense(I don't feel like it needs to be a module), and it also uses declarative testing for people to use.Minitest::Testdef test_something_does_something...endyou can dotest "something does something" do...endwhich makes it easier to read test names.I tested this locally in an app of mine and it works great! So it can allow a consistent way for people to write custom cops and easily test them!
Before submitting the PR make sure the following are checked:
[Fix #issue-number](if the related issue exists).master(if not - rebase it).bundle exec rake default. It executes all tests and runs RuboCop on its own code.{change_type}_{change_description}.mdif the new code introduces user-observable changes. See changelog entry format for details.