Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

34 lines (26 sloc) 0.778 kB
require 'fileutils'
def dirEmpty? dirname
return true unless File.directory?(dirname)
Dir.entries(dirname).size == 2
end
def tmpEmpty?
dirEmpty?(TEMPDIR)
end
def uploadEmpty?
photoModel = crazy_models.get_klass(:Photo)
dir = File.expand_path("../../tmp/uploads/#{photoModel.to_s.underscore}/avatar", __FILE__)
dirEmpty?(dir)
end
TEMPDIR = File.expand_path("../../tmp/uploads/tmp", __FILE__)
def carrierwave_test_photo
test_photo_path = File.expand_path("../../test.jpg", __FILE__)
File.open(test_photo_path, "rb")
end
def assert_photo_uploaded photo
photo.should_not be_nil
photo.file.should_not be_nil
photo.file.file.should_not be_nil
filename = photo.file.file
File.exist?(filename)
(filename =~ /avatar\/1\/test.jpg\Z/).should be_true
end
Jump to Line
Something went wrong with that request. Please try again.