Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Paperclip 3.0 can no longer test with fixture_file_upload #793

Closed
uberllama opened this issue Mar 27, 2012 · 8 comments
Closed

Paperclip 3.0 can no longer test with fixture_file_upload #793

uberllama opened this issue Mar 27, 2012 · 8 comments
Milestone

Comments

@uberllama
Copy link

All of my upload tests are broken after updating to 3.0. :( It looks like content type isn't being picked up.

avatar.rb

VALID_CONTENT_TYPES = ['image/bmp', 'image/gif', 'image/jpeg', 'image/jpg', 'image/pjpeg', 'image/png', 'image/x-png']
ATTACHMENT_CONTENT_TYPE_ERROR = 'must be a BMP, GIF, JPG, or PNG'


  has_attached_file :image,
    :styles => {:original => {:geometry => '160>', :source_file_options => '-auto-orient'}}
  validates_attachment_presence :image  
  validates_attachment_content_type :image, :content_type => VALID_CONTENT_TYPES, :message => ATTACHMENT_CONTENT_TYPE_ERROR
avatar = Avatar.create!(:image => fixture_file_upload('/files/avatar.jpg', 'image/jpg')

ActiveRecord::RecordInvalid: Validation failed: Image content type must be a BMP, GIF, JPG, or PNG
    /Users/yuval/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.4/lib/active_record/validations.rb:49:in `save!'
    /Users/yuval/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.4/lib/active_record/attribute_methods/dirty.rb:30:in `save!'
    /Users/yuval/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.4/lib/active_record/transactions.rb:245:in `block in save!'
    /Users/yuval/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.4/lib/active_record/transactions.rb:292:in `block in with_transaction_returning_status'
    /Users/yuval/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.4/lib/active_record/connection_adapters/abstract/database_statements.rb:139:in `transaction'
    /Users/yuval/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.4/lib/active_record/transactions.rb:207:in `transaction'
    /Users/yuval/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.4/lib/active_record/transactions.rb:290:in `with_transaction_returning_status'
    /Users/yuval/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.4/lib/active_record/transactions.rb:245:in `save!'
    /Users/yuval/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.4/lib/active_record/validations.rb:34:in `create!'
    test/unit/avatar_test.rb:20:in `block in <class:AvatarTest>'

Content type does not seem to be getting passed anymore when creating attachments directly.

@sikachu
Copy link
Contributor

sikachu commented Mar 27, 2012

That has been addressed in #792. Sorry for the troubled. Can you try with current master?

@sikachu
Copy link
Contributor

sikachu commented Mar 27, 2012

I should rephrase it. Can you try with master and see if it's still broken?

@uberllama
Copy link
Author

Thanks sikachu, I patched in the new validation code and all seems to be well again. I do wonder though if 3.0 is ready for primetime. This is a pretty fundamental bug. Is 3.0.1 slated soon?

@sikachu
Copy link
Contributor

sikachu commented Mar 27, 2012

I will do 3.0.1 release later today after I'm done with client's work. I agree that it's fundamental, and I'm pretty worry about it as well.

@uberllama
Copy link
Author

You the man.

@simonmorley
Copy link

Yeah, this is busting my nuts today ;)

@sikachu
Copy link
Contributor

sikachu commented Mar 30, 2012

Sorry, I didn't have a chance to do any release yet. I'll definitely do it today, as we're reaching another release cycle today.

@uberllama
Copy link
Author

Sounds good!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants