Given this factory:
FactoryGirl.define do
factory:prospect do
account
end
end
where "account" points to a valid Factory (and works fine), I can't figure out how to override the account in my test.
I've tried this:
account = FactoryGirl.create( :account )
prospect = FactoryGirl.create( :prospect, account: account )
expect( prospect.account ).to eq account
But it doesn't, I get two separate account objects. Any idea (a) why this is happening and/or (b) how to override the account creation in the spec test?
Many thanks
I tried your code and I get a green dot.
Do you have
FactoryGirl.define do
factory :account do
end
end
and everything correctly set up in your models and database?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.