test failure when using VCR with paperclip

520 Views Asked by At

I have a test that works, and passes, the first time but fails the second time the spec suite is run:

  VCR.use_cassette("master_image_create_2", :match_requests_on => [:method, :uri]) do
      mi = Factory.build(:master_asset)
      img = File.new( File.join(Rails.root, "spec", "support", "fonzi.jpg") )
      mi.image = img
      mi.valid?
      mi.sha.should eql("f70393ee4d6e1f6a735df9526694e038371e5b3c")
      mi.url.to_s.include?("http://domain.com/test-brand/original-test-product_f_test-color-1_test-color-2_test-color-3.jpg").should be_true
    end

The MasterAsset class uses paperclip (requirement) to upload the image being processed to S3.

The error I get back is:

AWS::Errors::Base:
 # (eval):3:in `head_object'

which is an error in the interface between paperclip and aws-s3.

I've been troubleshooting, googling for a few hours now. It seems like it should be a very common situation but I can't seem to get the test to pass a second time.

1

There are 1 best solutions below

1
On

This is probably a bug in either VCR or the underlying library VCR is hooking into (e.g. WebMock).

Can you file an issue on github? I'll be happy to take a look. I'll need more detail though:

  • Full backtrace of your error
  • Code snippet of your VCR configuration
  • A small, isolated executable example demonstrating the error would be nice.