Skip to content

Conversation

joseph-carino
Copy link

Closes #1396

Adds new cop for assert_changes, preventing its usage with a non-string, non-symbol second argument. This avoid accidental use of assert_changes with an expected value delta check.

Includes an autocorrect that replaces assert_changes with assert_difference, which does accept a second argument value delta check.


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.
  • If this is a new cop, consider making a corresponding update to the Rails Style Guide.
@joseph-carino joseph-carino force-pushed the add_assert_changes_second_argument_cop branch 2 times, most recently from 04115f4 to e6af276 Compare December 23, 2024 17:02
@joseph-carino joseph-carino force-pushed the add_assert_changes_second_argument_cop branch from e6af276 to 6dad261 Compare February 25, 2025 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants