Hi, Can anyone familiar with the use of factory_girl please comment on why I don''t succeed with the following: has_one_instance = Factory.build(:has_one_class) assert_equal 10, has_one_instance.belongs_to_class.some_attribute ...when I''ve constructed the relevant factories, as follows: Factory.define :belongs_to_class do |f| f.some_attribute 10 ... f.association :has_one_class, :factory => :has_one_class end Factory.define :has_one_class do |f| ... end ...and the model classes have the indicated belongs_to:has_one relationship? (A further complicating factor may be the peculiar warning message I''m getting post-factory_girl install: Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement) Thanks for any comment, Grar -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Grary
2010-Mar-22 16:59 UTC
Re: factory_girl factory gem: problem with simple associations
No takers, huh? On Mar 22, 10:00 am, Grary <grary.sti...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > Can anyone familiar with the use of factory_girl please comment on why > I don''t succeed with the following: > > has_one_instance = Factory.build(:has_one_class) > assert_equal 10, has_one_instance.belongs_to_class.some_attribute > > ...when I''ve constructed the relevant factories, as follows: > > Factory.define :belongs_to_class do |f| > f.some_attribute 10 > ... > f.association :has_one_class, :factory => :has_one_class > end > > Factory.define :has_one_class do |f| > ... > end > > ...and the model classes have the indicated belongs_to:has_one > relationship? > > (A further complicating factor may be the peculiar warning message I''m > getting post-factory_girl install: Warning: > Gem::Dependency#version_requirements is deprecated and will be removed > on or after August 2010. Use #requirement) > > Thanks for any comment, > > Grar-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.