mardi 28 mai 2019

FactoryGirl.create not working as expected

While writing rspec test cases, I am stuck at this point, where factory girl is creating instances for one model and not for another.

let!(:server) { FactoryGirl.create(:server, 
                  account: account, 
                  key: 'vm-999') }
let!(:host) { FactoryGirl.create(:host,                                      
                  account: account,
                  key: 'host-9') }

After these, when I query server from db, I am getting this object but when I query host, I am getting nil. I am not sure whether factory girl is creating the instance or not.

I am doing reload in Rspec.configure

 FactoryGirl.reload
 FactoryGirl.lint

What am I missing ?

Aucun commentaire:

Enregistrer un commentaire