attachinary
attachinary copied to clipboard
attachinary problem in cucumber test, using timecop
I'm using an attachinary image in a FactoryGirl object. This worked fine, until I started using timecop. Now I'm getting a cloudinary error "Stale request - reported time is 2013-09-17 08:05:02 +0000 which is more than 1 hour ago (CloudinaryException)", which apparently is thrown by the remove_tag method call after creating the image.
Any suggestions on how to get around this problem? Highly appreciated!
FactoryGirl code:
FactoryGirl.define do
factory :advertisement do
name "Advertisement"
after(:build) do |advertisement|
advertisement.image ||= FactoryGirl.build(:image)
end
end
factory :image, class: Attachinary::File do
sequence(:public_id) { |n| "id#{n}"}
sequence(:version) { |n| "#{n}"}
width 125
height 150
format 'jpg'
resource_type 'image'
end
end
The best solution at the moment is to call timecop's return before uploading the images. Keeping open for better way of mocking attachinary file upload.