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

Use automock to mock traits instead of the mock! macro #155

Merged
merged 1 commit into from
May 23, 2024

Conversation

spencewenski
Copy link
Member

There were a couple places we were using mock! instead of automock. IIRC this was because automock wasn't working for async_trait traits; however, after reading the mockall docs, I found that automock needs to be placed before async_trait in order for it to work. Also, specifically for the App trait, I just learned how to specify associated types with automock.

With this new knowledge, we can replace a couple manual mock! impls with automock.

There were a couple places we were using `mock!` instead of `automock`.
IIRC this was because `automock` wasn't working for `async_trait`
traits; however, after reading the `mockall` docs, I found that
`automock` needs to be placed _before_ `async_trait` in order for it to
work. Also, specifically for the `App` trait, I just learned how to
specify associated types with `automock`.

With this new knowledge, we can replace a couple manual `mock!` impls
with `automock`.
@spencewenski spencewenski merged commit 486fe02 into main May 23, 2024
8 checks passed
@spencewenski spencewenski deleted the use-automock-where-possible branch May 23, 2024 18:36
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