title: Can't figure out what's causing my tests to fail
body: <p>I'm new to rails and I built an app without doing TDD but am now going back and trying to pass all the tests. I've passed most of them but there are a few left relating to the same issue that I can't figure out. The app functions correctly as well, I just can't pass these tests.</p>
  
  <p>The tests fail and provide this:</p>
  
  <pre><code>1) ProductsController POST create with valid params assigns a newly created product as @product
   Failure/Error: post :create, {:product =&gt; valid_attributes}, valid_session
   Paperclip::AdapterRegistry::NoHandlerError:
     No handler found for "#&lt;File:0x007fc6d17b28f8&gt;"
   # ./app/controllers/products_controller.rb:43:in `new'
   # ./app/controllers/products_controller.rb:43:in `create'
   # ./spec/controllers/products_controller_spec.rb:86:in `block (4 levels) in &lt;top (required)&gt;'
  
  2) ProductsController POST create with valid params creates a new Product
   Failure/Error: post :create, {:product =&gt; valid_attributes}, valid_session
   Paperclip::AdapterRegistry::NoHandlerError:
     No handler found for "#&lt;File:0x007fc6d1757cf0&gt;"
   # ./app/controllers/products_controller.rb:43:in `new'
   # ./app/controllers/products_controller.rb:43:in `create'
   # ./spec/controllers/products_controller_spec.rb:81:in `block (5 levels) in &lt;top (required)&gt;'
   # ./spec/controllers/products_controller_spec.rb:80:in `block (4 levels) in &lt;top (required)&gt;'
  
  3) ProductsController POST create with valid params redirects to the created product
   Failure/Error: post :create, {:product =&gt; valid_attributes}, valid_session
   Paperclip::AdapterRegistry::NoHandlerError:
     No handler found for "#&lt;File:0x007fc6d36b3dd8&gt;"
   # ./app/controllers/products_controller.rb:43:in `new'
   # ./app/controllers/products_controller.rb:43:in `create'
   # ./spec/controllers/products_controller_spec.rb:92:in `block (4 levels) in &lt;top (required)&gt;'
  </code></pre>
  
  <p>The "create" method in my controller:</p>
  
  <pre><code>def create
    @product = Product.new(params[:product])
  
    respond_to do |format|
      if @product.save
        format.html { redirect_to admin_path, notice: 'Product was successfully created.' }
        format.json { render json: @product, status: :created, location: @product }
      else
        format.html { render action: "new" }
        format.json { render json: @product.errors, status: :unprocessable_entity }
      end
    end
  end
  </code></pre>
  
  <p>My Model:</p>
  
  <pre><code>class Product &lt; ActiveRecord::Base
    attr_accessible :designed, :features, :photo, :manufactured, :name, :case_study
  
    has_attached_file :photo, { 
      :styles =&gt; {
        :thumb =&gt; "x50&gt;", 
        :small =&gt; "x150&gt;", 
        :detail =&gt; "x600&gt;"
      }
    }.merge(PAPERCLIP_STORAGE_OPTIONS)
  
    validates_attachment_presence :photo
    validates_attachment_size :photo, :less_than =&gt; 5.megabytes
    validates_attachment_content_type :photo, :content_type =&gt; ['image/jpeg', 'image/png']
  end
  </code></pre>
  
  <p>My test:</p>
  
  <pre><code>before(:each) do
    @image = File.new(Rails.root + 'spec/fixtures/images/test.png')
  end 
  
  def valid_attributes
    { "photo" =&gt; @image }
  end
  
  describe "POST create" do
  describe "with valid params" do
    it "creates a new Product" do
      expect {
        post :create, {:product =&gt; valid_attributes}, valid_session
      }.to change(Product, :count).by(1)
    end
  
    it "assigns a newly created product as @product" do
      post :create, {:product =&gt; valid_attributes}, valid_session
      assigns(:product).should be_a(Product)
      assigns(:product).should be_persisted
    end
  
    it "redirects to the created product" do
      post :create, {:product =&gt; valid_attributes}, valid_session
      response.should redirect_to(admin_path)
    end
  end
  end
  </code></pre>