How to Test Multimodel Paperclip attachments?

I'm using Rspec and FactoryGirl to create specs for multimodel paperclip
attachments. From searching other questions, it seems like a single
image attachment is more common.


    class Car < ActiveRecord::Base
      has_many :uploads, dependent: :destroy

      validates :uploads, presence: { message: 'You must upload at least
one image' }

      accepts_nested_attributes_for :uploads, allow_destroy: true

    class Upload < ActiveRecord::Base
      belongs_to :car

      has_attached_file :upload, styles: { medium: '300x300>', thumb:
'100x100>' }

      validates_attachment_content_type :upload, content_type:
      validates_attachment_presence :upload

As you can see there is a has_many and belongs_to relationship between
the two.


    require 'spec_helper'

    describe Car do
      before do
        @car =

      subject { @car }

      it { should respond_to(:uploads) }

      it { should be_valid }

cars.rb factory

    FactoryGirl.define do
      factory :car do
        # Something
I have tried `uploads { FactoryGirl.create!(:upload) }` as well as using
the `fixture_file_upload` directly on the Car's uploads attribute. Also
I read about Associations,but I wasn't sure how that work.

For the upload factory I've done how you would test an individual


    include ActionDispatch::TestProcess

    FactoryGirl.define do
      factory :upload do
        upload { fixture_file_upload(Rails.root.join('spec', 'fixtures',
'support', 'test.jpg'), 'image/jpeg') }