Reputation: 10208
For some reason, when I run
rspec specs
The models defined on Factory girl are automatically created. I was expecting to create the objects with sentences like:
FactoryGirl.create(:user)
But I am having a lot of duplication problems due to this.
Moreover, if I go to the rails console and I type:
require 'factory_girl_rails'
It inserts some records on my database.
Is this expected behavior?
UPDATE: The problem was on my factory (silly mistake). I was calling create method there.
FactoryGirl.define do
factory :user do
email "[email protected]"
first_name "Myname"
last_name "MyLast name"
password "DoeDoe12"
api_license FactoryGirl.create(:api_license)
end
end
Upvotes: 1
Views: 107
Reputation: 176352
No, this is not. Are you sure these records are created by FactoryGirl?
Make sure you are not loading seeds or fixtures. If you empty the /factories folder and the records are still created, then the culprit is someone else.
Upvotes: 1