OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/spec/support/uploaded_file.rb

27 lines
521 B

class UploadedFile
attr_reader :pathname
def initialize(pathname)
@pathname = pathname
end
def path
pathname.to_s
end
def to_s
path
end
def basename
File.basename(path)
end
def self.load_from(path)
full_path = Rails.root.join(path)
shared_path = DownloadList::SHARED_PATH.join(File.basename(full_path))
# with remote drivers, files to upload must be in the shared downloads folder
FileUtils.cp(full_path, shared_path, verbose: true)
new(shared_path)
end
end