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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -