ruby on rails - Locating uploaded file with Rspec 3 -
I am trying to find out my last uploaded file (using careership) and method to run 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> and it creates the following files Thanks OK, by finding that I need to store my file has_dimensions This is a mistake in my test result in the moment a Rspec
with failure / error. Expect (@ uploader.large_animal_image) to have_dimensions. Campaign (555, 365) Errno :: ENOENT: Any such file or directory @ rb_sysopen -
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;
/ 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?
@ uploader Store! (I'm stupid)
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