FFaker Gem
Have any of you heard of the FFaker gem? If you have not, then I suggest you make use if it. Those days of thinking up unique and creative names for every single thing are long gone.
I also highly recommend that you use it in conjunction with FactoryGirl. They go together like chalk in a Cheeseburger.
Example of FFaker in use
FactoryGirl.define do
factory :project do
name { FFaker::Name.name }
no { FFaker::Product.model }
end
end
You can then do something like this:
project_just_created = create(:project)
project_just.created.name
## this could return any name. e.g.
## "Haris Pilton" depending on what
## the gem randomly selects.
Notice how it saves you thinking up random and unique names, especially if you want to create 10 different projects, with different names?
I hope this helps you.
Written on May 11, 2017