Created
July 25, 2014 21:19
-
-
Save ixti/f258a223fbbe568c2e12 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "benchmark/ips" | |
require "factory_girl" | |
require "fabrication" | |
require "mongo_mapper" | |
class Foo | |
include MongoMapper::Document | |
key :name | |
key :email | |
end | |
Fabricator :foo do | |
name { %w[alice bob charlie].sample } | |
email { |attrs| sequence { |i| "#{attrs[:name]}-#{i}gmail.com" } } | |
end | |
FactoryGirl.define do | |
factory :foo do | |
name { %w[alice bob charlie].sample } | |
sequence(:email) { |i| "#{name}-#{i}gmail.com" } | |
end | |
end | |
Benchmark.ips do |x| | |
x.config :time => 5, :warmup => 2 | |
x.report("Fabrication") { Fabricate.build :foo } | |
x.report("FactoryGirl") { FactoryGirl.build :foo } | |
end |
Author
ixti
commented
Jul 25, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment