views:

17

answers:

0

Hi,

I have the following shoulda set up which I would like to use factory_girl to have the fake model available in other specs.

So far I have this:

  context "on POST to parse" do
    setup do
      @fuzzy_lead = LeadCapturer::FuzzyLead.new

      parts = LeadCapturer::LeadPartArray.new

      parts << LeadCapturer::LeadPart.new('Mc Burney & Cowan', LeadCapturer::TextTag.new, 0)
      parts << LeadCapturer::LeadPart.new('2 Lena Street', LeadCapturer::TextTag.new, 1)
      parts << LeadCapturer::LeadPart.new('Belfast', LeadCapturer::TextTag.new, 2)
      parts << LeadCapturer::LeadPart.new('Down', LeadCapturer::TextTag.new, 3)
      parts << LeadCapturer::LeadPart.new('BT5 5BJ', LeadCapturer::PostCodeTag.new, 4)
      parts << LeadCapturer::LeadPart.new('Tel: 028 9047 1054', LeadCapturer::PhoneTag.new, 5)
      parts << LeadCapturer::LeadPart.new('Fax: 028 9047 1054', LeadCapturer::FaxTag.new, 6)
      parts << LeadCapturer::LeadPart.new('[email protected]', LeadCapturer::EmailTag.new, 7)
      parts << LeadCapturer::LeadPart.new('http://www.mcburneyandcowan.com/', LeadCapturer::WebSiteTag.new, 8)
      parts << LeadCapturer::LeadPart.new('General Manager: Mike Halliday', LeadCapturer::ContactTag.new, 9)

      @fuzzy_lead.instance_eval do
        @parts = parts
      end
    end

I know how to set up associations in factory_girl but I am not sure how I would set up the above in factory_girl.

Maybe it is not a good fit for this situation.

Can anyone help me out?

Cheers

Paul