rsantamaria / papercrop

An easy extension for Paperclip to crop your image uploads using jCrop.
203 stars 83 forks source link

Now supporting Paperclip 4.1 #13

Closed Emerson closed 10 years ago

Emerson commented 10 years ago

Howdy,

Using this on a new project and wanted to use the latest version of Paperclip (4.1). There were some issues that I believe I've resolved. In particular, the requirement that all models with attachments validate the content type.

In truth, most of the issues I had to fix were related to tests. The Paperclip API has changed some and adjustments needed to be made.

I've also made the ImageMagick test comparisons a little more forgiving. All of the comparison tests were failing for me due to a 0.004 percent difference. I chalked this up to different versions of ImageMagick doing cropping a little differently and am now rounding to two decimal places. It will still fail if the crops are done wrong, but very subtile differences between ImageMagick versions should no longer cause tests to fail.

Let me know if you need anything else done. Looking forward to getting this PR merged so I can stop using my own fork.

Keep well, Emerson

rsantamaria commented 10 years ago

Hello Emerson

That's great! really, thanks.

I don't have so much time lately to dive into Rails4, looks nice and everything runs green. Testing support is always welcome :) Good point on the ImageMagick workaround, it often fails randomly. Ah, the dummy app tests, you shouldn't have worried about them, they're dummy, the gem specs are the real tests and should be enough.

The thing that keeps me wondering is the fact that commits made to support rails/paperclip incompatibilities would break features for older versions. It's ok, looks like Rails 4 isn't a problem but the specs will no longer support rails 3.X or paperclip 3 (older or earlier versions of the 'attachment_definitions' incident). For example the model_extension_spec.rb:63 https://github.com/Emerson/papercrop/commit/636aa1313ffd2b2606a23ff8d568f1e5cc73033f#diff-bddf337f79936194feb1f8882cd3a156L62

I should give a try to appraisal https://github.com/thoughtbot/appraisal It looks like the way to afford this kind of problems.

Regards