Hi,
I have the following factories:
Factory.define :email do |email|
email.email {"infomcburney.cowan.com"}
end
Factory.define :lead do |lead|
lead.emails {|emails| [emails.association(:email)]}
end
Which are modeling the following classes
class Lead < ActiveRecord::Base
has_many :emails
end
class Email < ActiveRecord::Base
belongs_to :lead, :class_name => "Lead", :foreign_key => "lead_id"
end
When I run the this test through shoulda:
should "capture emails" do
lead = Factory.build(:lead)
assert_equal(1, lead.emails.size)
end
I get the following error:
Factory::AttributeDefinitionError: Attribute already defined: emails
I am completely stuck on this, can anyone point me in the right direction. I am using factory_girl 1.3.2.
Cheers
Paul