fg-quickgenerate (FactoryGirl addon)
Hello fellas! This gem was create to made easy way of creating quick sequences in FactoryGirl.
Installation
Add this line to your application's Gemfile:
gem 'fg-quickgenerate'
And then execute:
$ bundle
Or install it yourself as:
$ gem install fg-quickgenerate
Usage
First of all, require fg-quickgenerate below FactoryGirl require, like that: require 'factory_girl' require 'fg-quickgenerate'
After require you will be able to create simple sequentials like:
FactoryGirl.define do
factory :user do
name { sequential("myname") }
email { sequential("myemail#[email protected]") }
end
end
Doing this, your tests will look like that:
u1 = build(:user)
u1.name # myname1
u1.email # [email protected]
u2 = build(:user)
u2.name # myname2
u2.email # [email protected]
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request