Skip to content

Instantly share code, notes, and snippets.

@databyte
Created April 3, 2012 22:19
Show Gist options
  • Save databyte/2295881 to your computer and use it in GitHub Desktop.
Save databyte/2295881 to your computer and use it in GitHub Desktop.
CarrierWave Uploader spec stubbing
CarrierWave::Uploader::Base.descendants.each do |klass|
next if klass.anonymous?
klass.class_eval do
def cache_dir
"#{Rails.root}/public/system/test/#{Process.pid.to_s}/tmp"
end
def store_dir
"#{Rails.root}/public/system/test/#{Process.pid.to_s}/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
def url
super
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment