Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, our tests are a mess as far as
Account
andUser
models areFabricate
d, there's lots of boilerplate, a lot of cargo-cult, multiple ways of expressing stuff, as well as a lot of cases where local accounts have no associated records and some cases when remote accounts do, neither of which is representative of the state of objects in production.To remedy this, this PR changes the
:account
and:user
fabricators so that:Fabricate(:account)
implicitly fabricates an associateduser
if nodomain
attribute is given (user: nil
can be passed to avoid that).Fabricate(:account, user: Fabricate(:user))
should still be possible but is discouraged.Tests were then fixed:
Fabricate
d users and accounts in different steps (causing lingering records that were not expected)And refactored:
Fabricate(:user)
andFabricate(:account)
(this includes passing unneeded embedded calls toFabricate(:user)
andFabricate(:account)
)Fabricate(:user, account_attributes: …)
toFabricate(:user, account: Fabricate(:account, …)
Fabricate(:user)
into aFabricate(:account)
or the otherFabricate(:account)
overFabricate(:user).account