I'm working with FactoryGirl
in version 4.4
. I'm trying to create after(:create)
callbacks but I'm failing on evaluator variables.
FactoryGirl.define do
factory :organization do
name 'example'
factory :organization_with_links do
transient do
links_count 5
end
after(:create) do |organization, evaluator|
create_list(:link, evaluator.links_count, organization: organization)
end
end
end
end
unfortunately I got
NoMethodError: undefined method `links_count' for FactoryGirl::SyntaxRunner:0x007fcefb1ff780>
according to officall factory girl guide I'm doing everything properly :https://github.com/thoughtbot/factory_girl/blob/master/GETTING_STARTED.md#associations
any advices how to make transient variable
working?