For some applications, I use Paperclip to download files (actually dm-paperclip flavor) and Factory Girl, Rspec, Capybara for testing. I have a very simple Factory model for the Picture model, in which I correct my file properties as suggested in this post :
FactoryGirl.define do
factory :picture do
title "My Picasso"
description "It like looking in a mirror."
picture_file_file_name { 'spec/resources/img_1.jpg' }
picture_file_content_type { 'image/jpg' }
picture_file_file_size { 1024 }
end
end
In various property tests with Capybara, I visit pages where templates have thumbnails of Picture instances:
feature "List of Pictures", :js => true do
scenario "displays appropriately the index page of the pictures with pagination" do
FactoryGirl.create_list(:picture, 21)
visit '/pictures'
end
end
An example of partial use in one of the templates:
= content_tag_for(:li, picture, :class => 'listed_picture') do
= link_to picture_path(picture) do
- if picture.picture_file?
= image_tag picture.picture_file.url(:thumb)
The problem that I am facing now is when I run the specifications, the test fails because there is no suitable route for sketching the sketch:
No route matches [GET] "/system/picture_files/1/thumb/img_1.jpg"
Is there a way to drown out the auxiliary clip methods to pass the test?
Thanks in advance for your help!