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 parent strategy when building associations in factories #134

Merged
merged 1 commit into from
Jul 24, 2020

Conversation

aldesantis
Copy link
Member

Adjusts the factories to always use association when building associated records. This fixes a weird bug that would occur when creating a subscription_line_item (and potentially others).

This avoids surprising scenarios where we expect a `create` call to
result in all records being persisted to the DB, while some associated
records are still unsaved.

This was especially problematic when building subscription line items,
because the order is retrieved through a `has_one :through` association
on the `Spree::LineItem` record. If the line item isn't saved, the order
cannot be retrieved, resulting in unexpected errors.
@aldesantis aldesantis force-pushed the aldesantis/factories-parent-strategy branch from 73832c9 to c3a6c03 Compare July 24, 2020 13:33
@aldesantis aldesantis merged commit 186f09b into master Jul 24, 2020
@aldesantis aldesantis deleted the aldesantis/factories-parent-strategy branch July 24, 2020 13:44
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