2012-11-13 FactoryGirl は いい女 FactoryGirlについて調べてた。 宣言 spec/factories/users.rb FactoryGirl.define do factory :user do name 'hrysd' sequence :email { |n| "test_#{n}@email.com" } trait :active status 'active' end trait :inactive status 'inactive' end end end 簡単な説明 sequence ユニーク制限がある値のときに便利。 n が増えてく。 FactoryGirl.create(:user) => #<User id: 1, name: 'hrysd', email: 'test_1@email.com', status: nil> Facto