Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.

Commit b20c05f

Browse files
Fix locally broken spec
There is a repeatable and persistent spec failure on multiple (all?) local Ruby installations in this location: `/spec/controllers/v0/preneeds/preneed_attachments_controller_spec.rb:7` The stacktrace is ``` 2019-09-18 09:49:15.919951 D [28322:70295016921020] V0::Preneeds::PreneedAttachmentsController -- Processing #create 2019-09-18 09:49:19.287652 E [28322:70295016921020 sentry_logging.rb:57] Rails -- Failed to manipulate with MiniMagick, maybe it is not an image? Original Error: `identify /var/folders/yj/9j91j4gj2sqbkll8mrxy3h8r0000gn/T/mini_magick20190918-28322-1f7ayhd.pdf` failed with error: . 2019-09-18 09:49:19.287793 E [28322:70295016921020 sentry_logging.rb:57] Rails -- /Users/johnpaul/work/oddball/vets-api/.bundle/gems/carrierwave-0.11.2/lib/carrierwave/processing/mini_magick.rb:273:in `rescue in manipulate!' /Users/johnpaul/work/oddball/vets-api/.bundle/gems/carrierwave-0.11.2/lib/carrierwave/processing/mini_magick.rb:258:in `manipulate!' /Users/johnpaul/work/oddball/vets-api/.bundle/gems/carrierwave-0.11.2/lib/carrierwave/processing/mini_magick.rb:108:in `convert' /Users/johnpaul/work/oddball/vets-api/.bundle/gems/carrierwave-0.11.2/lib/carrierwave/uploader/processing.rb:84:in `block in process!' /Users/johnpaul/work/oddball/vets-api/.bundle/gems/carrierwave-0.11.2/lib/carrierwave/uploader/processing.rb:76:in `each' /Users/johnpaul/work/oddball/vets-api/.bundle/gems/carrierwave-0.11.2/lib/carrierwave/uploader/processing.rb:76:in `process!' /Users/johnpaul/work/oddball/vets-api/.bundle/gems/carrierwave-0.11.2/lib/carrierwave/uploader/callbacks.rb:18:in `block in with_callbacks' /Users/johnpaul/work/oddball/vets-api/.bundle/gems/carrierwave-0.11.2/lib/carrierwave/uploader/callbacks.rb:18:in `each' /Users/johnpaul/work/oddball/vets-api/.bundle/gems/carrierwave-0.11.2/lib/carrierwave/uploader/callbacks.rb:18:in `with_callbacks' /Users/johnpaul/work/oddball/vets-api/.bundle/gems/carrierwave-0.11.2/lib/carrierwave/uploader/cache.rb:134:in `cache!' /Users/johnpaul/work/oddball/vets-api/.bundle/gems/carrierwave-0.11.2/lib/carrierwave/uploader/store.rb:56:in `store!' /Users/johnpaul/work/oddball/vets-api/app/models/form_attachment.rb:15:in `set_file_data!' /Users/johnpaul/work/oddball/vets-api/app/controllers/concerns/form_attachment_create.rb:14:in `create' ``` but the real issue stems from the `preneed_attachment_uploader` ``` process(convert: 'pdf', if: :not_pdf?) ... def not_pdf?(file) file.content_type != 'application/pdf' end ``` This tries to process the uploaded file if its not a PDF. The fixture was being uploaded without a specified type, which evaluated to `""` and triggered the PDF conversion process. This process failed because the file was not an image. Staging possibly works because of a different minimagick/ImageMagick version with different rules?
1 parent d600ab2 commit b20c05f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

spec/controllers/v0/preneeds/preneed_attachments_controller_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
describe '#create' do
77
it 'uploads a preneed attachment' do
88
post(:create, params: { preneed_attachment: {
9-
file_data: fixture_file_upload('pdf_fill/extras.pdf')
9+
file_data: fixture_file_upload('preneeds/extras.pdf', 'application/pdf')
1010
} })
1111

1212
expect(JSON.parse(response.body)['data']['attributes']['guid']).to eq Preneeds::PreneedAttachment.last.guid

0 commit comments

Comments
 (0)