Prints number of times when factory was build or create and time (avg, min, max) that it took after test suite
Add this line to your application's Gemfile:
gem 'factory_girl_profiling'
And then execute:
$ bundle
Or install it yourself as:
$ gem install factory_girl_profiling
Add env var when running test to collect and print statistic after test suite
PROFILE_FACTORY_GIRL=1
What's happennig is:
RSpec.configure do |config|
config.before(:suite) do
ActiveSupport::Notifications.subscribe("factory_girl.run_factory") do |name, start, finish, id, payload|
FactoryGirlProfiling::Profiler.add(name, start, finish, id, payload)
end
end
config.after(:suite) do
FactoryGirlProfiling::Profiler.print_results
FactoryGirlProfiling::Profiler.reset
end
end
For more info about FactoryGirl read FactoryGirl Wiki
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request