We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I see this frequently:
factory(:status_message) do author after(:build) do |sm| FactoryBot.create(:poll, status_message: sm) end
This won't work with build_stubbed.
build_stubbed
The can be written as (see Interconnected Associations):
factory(:status_message, aliases: %i[status_message_without_participation]) do author poll { assoiation :poll, status_message: instance } end
instance was added in FactoryBot 6.1.0, @instance can be used in older versions.
instance
@instance
This also works for has_many:
has_many
factory :user_with_five_posts do posts do Array.new(5) { association(:post) } end end
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I see this frequently:
This won't work with
build_stubbed
.The can be written as (see Interconnected Associations):
instance
was added in FactoryBot 6.1.0,@instance
can be used in older versions.This also works for
has_many
:The text was updated successfully, but these errors were encountered: