Skip to content

Instantly share code, notes, and snippets.

@Lackoftactics
Created February 26, 2018 12:47
Show Gist options
  • Save Lackoftactics/e4a7268589edbe7b1526e17f712329f3 to your computer and use it in GitHub Desktop.
Save Lackoftactics/e4a7268589edbe7b1526e17f712329f3 to your computer and use it in GitHub Desktop.
factory bot traits
FactoryGirl.define do
factory :registration_participant, class: Registration::Participant do
f_name { Faker::Name.first_name }
l_name { Faker::Name.last_name }
waiver_agree true
token SecureRandom.hex(10)
association :registrant, factory: :registration_registrant
trait :skip_validate do
registrant nil
to_create { |instance| instance.save(validate: false) }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment