2010-05-11 21:38:52 +00:00
|
|
|
require 'carrierwave/test/matchers'
|
|
|
|
|
|
|
|
CarrierWave.configure do |config|
|
|
|
|
config.storage = :file
|
2011-04-24 23:21:38 +00:00
|
|
|
# config.store_dir = "spec/tmp/uploads"
|
2010-05-11 21:38:52 +00:00
|
|
|
config.cache_dir = "spec/tmp/cache"
|
|
|
|
config.root = File.join(Rails.root, 'spec', 'tmp')
|
|
|
|
end
|
|
|
|
|
|
|
|
module FixturedAsset
|
|
|
|
def self.open(filename)
|
|
|
|
File.new(self.path(filename))
|
|
|
|
end
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-05-11 21:38:52 +00:00
|
|
|
def self.path(filename)
|
|
|
|
File.join(File.dirname(__FILE__), '..', 'fixtures', 'assets', filename)
|
|
|
|
end
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-05-11 21:38:52 +00:00
|
|
|
def self.duplicate(filename)
|
|
|
|
dst = File.join(File.dirname(__FILE__), '..', 'tmp', filename)
|
|
|
|
FileUtils.cp self.path(filename), dst
|
|
|
|
dst
|
|
|
|
end
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-05-11 21:38:52 +00:00
|
|
|
def self.reset!
|
|
|
|
FileUtils.rm_rf(File.join(File.dirname(__FILE__), '..', 'tmp'))
|
|
|
|
FileUtils.mkdir(File.join(File.dirname(__FILE__), '..', 'tmp'))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-10-28 23:36:45 +00:00
|
|
|
module FixturedTheme
|
|
|
|
def self.open(filename)
|
|
|
|
File.new(self.path(filename))
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.path(filename)
|
|
|
|
File.join(File.dirname(__FILE__), '..', 'fixtures', 'themes', filename)
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.duplicate(filename)
|
|
|
|
dst = File.join(File.dirname(__FILE__), '..', 'tmp', filename)
|
|
|
|
FileUtils.cp self.path(filename), dst
|
|
|
|
dst
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.duplicate_and_open(filename)
|
|
|
|
File.open(self.duplicate(filename))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-07-23 20:09:54 +00:00
|
|
|
FixturedAsset.reset!
|