Good day!
I'm trying to create random values when creating model in my tests. Using factory_girl and faker gems
as of my gemfile.lock
factory_girl_rails (4.5.0)
factory_girl (~> 4.5.0)
faker (1.6.1)
I define factory as follows
FactoryGirl.define do
factory :action do
name Faker::Internet.email
id Faker::Number.digit
ip Faker::Internet.ip_v4_address
old_value Faker::Number.number(7)
end
end
but in my tests when i try to create objects, they have the same attributes.
> create :logger
id: 17,
new_value: 3133860,
name: "fidel_murazik@gibson.biz",
ip: "118.247.64.189",
created_at: Tue, 02 Feb 2016 09:12:50 UTC +00:00,
updated_at: Tue, 02 Feb 2016 09:12:50 UTC +00:00>
and the second time
> create :logger
id: 18,
new_value: 3133860,
name: "fidel_murazik@gibson.biz",
ip: "118.247.64.189",
created_at: Tue, 02 Feb 2016 09:12:53 UTC +00:00,
updated_at: Tue, 02 Feb 2016 09:12:53 UTC +00:00>
One more time - I'm trying to get via Faker gem random valid attributes for factory_girl every time I create a new object.
Can you please help me with this problem?