Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent breaking change for assertion message in test #247

Conversation

koic
Copy link
Member

@koic koic commented Mar 25, 2023

Follow up rubocop/rubocop#11729.

This PR prevents breaking change for assertion message in test. e.g.

% bundle exec ruby -Itest test/rubocop/cop/minitest/lifecycle_hooks_order_test.rb
(snip)

Fabulous run in 0.075080s, 93.2339 runs/s, 93.2339 assertions/s.

  1) Failure:
LifecycleHooksOrderTest#test_registers_offense_when_hooks_are_not_before_test_cases [test/rubocop/cop/minitest/lifecycle_hooks_order_test.rb:62]:
--- expected
+++ actual
@@ -4,7 +4,7 @@
   end

   def setup; end
-  ^^^^^^^^^^^^^^ `setup` is supposed to appear before `test_something`.
+  ^^^^^^^^^^^^^^ Minitest/LifecycleHooksOrder: `setup` is supposed to appear before `test_something`.
   def teardown; end
 end
 "

Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Ran bundle exec rake default. It executes all tests and runs RuboCop on its own code.
  • Added an entry (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.

Follow up rubocop/rubocop#11729.

This PR prevents breaking change for assertion message in test. e.g.

```console
% bundle exec ruby -Itest test/rubocop/cop/minitest/lifecycle_hooks_order_test.rb
(snip)

Fabulous run in 0.075080s, 93.2339 runs/s, 93.2339 assertions/s.

  1) Failure:
LifecycleHooksOrderTest#test_registers_offense_when_hooks_are_not_before_test_cases [test/rubocop/cop/minitest/lifecycle_hooks_order_test.rb:62]:
--- expected
+++ actual
@@ -4,7 +4,7 @@
   end

   def setup; end
-  ^^^^^^^^^^^^^^ `setup` is supposed to appear before `test_something`.
+  ^^^^^^^^^^^^^^ Minitest/LifecycleHooksOrder: `setup` is supposed to appear before `test_something`.
   def teardown; end
 end
 "
```
@koic koic force-pushed the prevent_breaking_change_for_assertion_message_in_test branch from 84f843d to a96a985 Compare March 25, 2023 07:42
@koic koic merged commit f63e45d into rubocop:master Mar 25, 2023
@koic koic deleted the prevent_breaking_change_for_assertion_message_in_test branch March 25, 2023 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant