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 raise_error messages #218

Merged
merged 1 commit into from
Feb 10, 2024
Merged

Improve raise_error messages #218

merged 1 commit into from
Feb 10, 2024

Conversation

mcmire
Copy link
Collaborator

@mcmire mcmire commented Feb 10, 2024

This commit makes some minor changes to the raise_error matcher to make the failure messages slightly more friendly and consistent with the overall philosophy of matchers in this repo.

Here are the current messages in comparison with the new ones:

  • In cases where the block raises no error, the wording changes from "Expected block" to "Expected exception-free block", and "exception-free block" is highlighted in the actual color. This is to emphasize the actual behavior vs. the expected behavior and matches other matchers.
  • In cases where only an expected error class is provided, the wording changes so that instead of inspecting the expected error, the failure message says "a kind of" followed by the class name.
  • In cases where a message is provided, the expected class and message are separated in the failure message.
  • In cases where a regexp message is provided, the wording changes from "with message #{message}" to "with message matching #{message}".

Additionally, the integration tests for raise_error have been reviewed and missing tests have been filled in.

This commit makes some minor changes to the `raise_error` matcher to
make the failure messages slightly more friendly and consistent with
the overall philosophy of matchers in this repo.

Here are the current messages in comparison with the new ones:

- In cases where the block raises no error, the wording changes
  from "Expected block" to "Expected exception-free block", and
  "exception-free block" is highlighted in the actual color. This is to
  emphasize the actual behavior vs. the expected behavior and matches
  other matchers.
- In cases where only an expected error class is provided, the wording
  changes so that instead of inspecting the expected error, the failure
  message says "a kind of" followed by the class name.
- In cases where a message is provided, the expected class and message
  are separated in the failure message.
- In cases where a regexp message is provided, the wording changes from
  "with message #{message}" to "with message matching #{message}".

Additionally, the integration tests for `raise_error` have been reviewed
and missing tests have been filled in.
@mcmire mcmire force-pushed the improve-raise-error-messages branch from 13b0772 to 8693014 Compare February 10, 2024 18:47
@mcmire mcmire merged commit 5700196 into main Feb 10, 2024
40 checks passed
@mcmire mcmire deleted the improve-raise-error-messages branch February 10, 2024 18:51
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