ruby on rails - Locating uploaded file with Rspec 3 -
I am trying to find out my last uploaded file (using careership) and has_dimensions This is a mistake in my test result in the moment a Rspec
method to run
with failure / error. Expect (@ uploader.large_animal_image) to have_dimensions. Campaign (555, 365) Errno :: ENOENT: Any such file or directory @ rb_sysopen - My test looks like this (after example Github tried on page but did not work as file upload.). Test :: Matchers included: Each) AnimalImageUploader.enable_processing = true @animal = FactoryGirl .create (: image) @uploader = AnimalImageUploader.new (@animal, image) A Mr. (@ uploader) @ Aploderkstor! End (: each) do @ uploader.remove! AnimalImageUploader.enable_processing = false End Reference 'Image Version' is the 'scale should big_animal_image to 555 x 365' (@ uploader.large_animal_image) has_dimensions (555, 365) end end end <. Campaign p> ap (@uploader) output
# & lt; AnimalImageUploader: 0x000000080ae738 @model = # & lt; AnimalImage ID: 50, animal_id: zero, image: "yp2 .jpg", created_t: "2014-10-10 07:41:20", updated_at: "2014-10-10 07:41:20" & gt ;, @ Mounted_as =: image & gt; and it creates the following files
/ support / animal_image / image / 50 yp2.jpg large_animal_image_yp2.jpg < P> How do I use those files to run them on the the_dimments method? Thanks
OK, by finding that @ uploader Store! (I'm stupid)
I need to store my file
Before (! Each)! Make AnimalImageUploader .enable_processing = true file = File.open ("# {Rails.root} /spec/fixtures/yp2.jpg") @animal = AnimalImage.create (Image: file) @uploader = AnimalImageUploader.new (@animal, image) @ Uploader.store! (File) expiration
Comments
Post a Comment