ruby on rails - How can I clobber factory girl associations? -
i have factory generated:
factorygirl.define sequence :account_login |n| "login-#{ n }" end factory :account sequence :email |n| "someone#{n}@gmail.com" end email_confirmation { |account| account.send :email } url { faker::internet.url } login { generate(:account_login) } password { faker::internet.password } password_confirmation { |account| account.send(:password) } current_password { |account| account.send(:password) } twitter_account 'openhub' name { faker::name.name + rand(999_999).to_s } about_raw { faker::lorem.characters(10) } activated_at { time.current } activation_code nil country_code 'us' email_master true email_kudos true email_posts true association :github_verification end end
what need create second factory creates user nil github_verification attribute.
something this:
factory :account_with_no_verifications, parent: :account associaton github_verification = nil end
is there way that?
just use factorygirl::strategy::null
http://www.rubydoc.info/github/thoughtbot/factory_girl/factorygirl/strategy/null
factory :account_with_no_verifications, parent: :account association github_verification, strategy: :null end
Comments
Post a Comment