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

feat: Add default qualifier to define_enum_for matcher #1627

Merged
merged 1 commit into from Apr 26, 2024

Conversation

matsales28
Copy link
Collaborator

On this commit we're adding a new qualifier to the define_enum_for matcher called with_default. This qualifier is used to test that the enum is defined with a default value. A proc can also be passed, and will be called once each time a new value is needed.

It's nice to note that using Time or Date as the return of Procs as default value can lead to flaky tests, so it's recommended to freeze time or date to avoid this.

@matsales28 matsales28 self-assigned this Apr 12, 2024
@matsales28 matsales28 force-pushed the feat-add-default-qualifier-to-enum-macro branch from 6be8656 to 0af95a0 Compare April 12, 2024 19:45
On this commit we're adding a new qualifier to the `define_enum_for`
matcher called `with_default`. This qualifier is used to test that the
enum is defined with a default value. A proc can also be passed, and
will be called once each time a new value is needed.

It's nice to note that using Time or Date as the return of Procs as
default value can lead to flaky tests, so it's recommended to
freeze time or date to avoid this.
@matsales28 matsales28 force-pushed the feat-add-default-qualifier-to-enum-macro branch from 0af95a0 to 7c2f413 Compare April 12, 2024 20:25
Copy link
Collaborator

@vsppedro vsppedro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

@matsales28 matsales28 merged commit c9d234a into main Apr 26, 2024
16 checks passed
@matsales28 matsales28 deleted the feat-add-default-qualifier-to-enum-macro branch April 26, 2024 18:32
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.

None yet

2 participants