title: How to test carrierwave version size with Rspec
body: <p>I have a CarrierWave::Uploader that produces three version of the uploaded image.</p>
  
  <pre><code># Process files as they are uploaded:                                                                  
     process :resize_to_fit =&gt; [400, 400]                                                                   
  
     # Create different versions of your uploaded files:                                                    
     version :thumb do                                                                                      
       process :resize_to_fit =&gt; [60, 60]
     end
  
     version :small do
       process :resize_to_fit =&gt; [24, 24]
     end
  </code></pre>
  
  <p>And in my tests I try to verify the dimensions of the generated images</p>
  
  <pre><code>require 'spec_helper'
  require 'carrierwave/test/matchers'
  
  describe 'manufacturer logo uploader' do
    include CarrierWave::Test::Matchers
  
    before(:each) do
      image_path = Rails.root.join('test/fixtures/images', 'avatar100.gif').to_s
      @manufacturer = Factory.create(:manufacturer, :page_status =&gt; 1)
      @manufacturer.logo_image = File.open(image_path)
      @manufacturer.save!
    end
  
    context "manufacturer logo dimensions" do
      it "should have three versions" do
        @manufacturer.logo_image.should have_dimensions(400,400)
        @manufacturer.logo_image.thumb.should have_dimensions(60,60)
        @manufacturer.logo_image.small.should have_dimensions(24,24)
      end
    end
  
  end
  </code></pre>
  
  <p>but this test depends on the actual image and resize_to_fit will not necessarily resize it to the specified dimensions. Any ideas on how to test this using stubs? </p>