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

Improve error messages of assert_changes and assert_no_changes #48482

Merged

Conversation

pcreux
Copy link
Contributor

@pcreux pcreux commented Jun 15, 2023

Motivation / Background

Make assert_changes error messages show objects with .inspect to make it easier to differentiate nil from empty strings, strings vs symbols, etc.

Make assert_no_changes error messages surface the actual value.

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug or add a feature.
  • CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

Let me know if I should update the CHANGELOG as this is a minor change.

@pcreux pcreux force-pushed the improve-assert_changes-error-messages branch from 6ce50aa to 40552b8 Compare October 6, 2023 08:17
@carlosantoniodasilva
Copy link
Member

I think it's worth a changelog entry, there's always a chance that someone might be caught off-guard by the change for some reason and would go searching the changelogs for any mention of it.

@pcreux pcreux force-pushed the improve-assert_changes-error-messages branch from 40552b8 to 13e6f24 Compare October 16, 2023 09:29
@pcreux
Copy link
Contributor Author

pcreux commented Oct 16, 2023

@carlosantoniodasilva I updated the CHANGELOG and rebased it against main.

@zzak
Copy link
Member

zzak commented Oct 20, 2023

Could you please squash your commits? 🙇

@pcreux pcreux force-pushed the improve-assert_changes-error-messages branch from 13e6f24 to 1f6fac7 Compare October 20, 2023 07:15
@pcreux
Copy link
Contributor Author

pcreux commented Oct 20, 2023

@zzak ✅ Done!

@pcreux
Copy link
Contributor Author

pcreux commented Oct 20, 2023

The build failed. Retrying...

@pcreux pcreux force-pushed the improve-assert_changes-error-messages branch from 1f6fac7 to 2879e71 Compare October 20, 2023 10:17
@pcreux
Copy link
Contributor Author

pcreux commented Oct 20, 2023

@zzak ✅ All checks have passed. The PR is ready to merge. 💚

@jonathanhefner jonathanhefner force-pushed the improve-assert_changes-error-messages branch from 3a4449b to 2b3a002 Compare October 30, 2023 18:31
@jonathanhefner jonathanhefner merged commit 1b195b3 into rails:main Oct 30, 2023
3 of 4 checks passed
@jonathanhefner
Copy link
Member

I pushed a commit to rebase.

Thank you, @pcreux! 🧪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants