require 'faker' FactoryGirl.define do factory :mission do sequence(:name){ |n| "Mission name #{n}" } sequence(:content){ |n| "Mission #{n}" } status "已完成" priority 1 deadline "2016-10-17 10:00:00" factory :no_content_mission do content nil end factory :no_deadline_mission do deadline nil end factory :no_status_mission do status nil end factory :no_priority_mission do priority nil end factory :priority_not_among_valid_values do priority 5 end factory :status_not_among_valid_values do status "不存在" end end end