Sha256: c38285d70354f2505088f1bc12fc9999708e171626c4d52210f0459db9366227
Contents?: true
Size: 1003 Bytes
Versions: 7
Compression:
Stored size: 1003 Bytes
Contents
def FactoryGirl.create_generic_file(container_factory_name_or_object, user, file = nil, &block) curation_concern = if container_factory_name_or_object.is_a?(Symbol) FactoryGirl.create_curation_concern(container_factory_name_or_object, user) else container_factory_name_or_object end generic_file = GenericFile.new yield(generic_file) if block_given? generic_file.visibility ||= AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED file ||= Rack::Test::UploadedFile.new(__FILE__, 'text/plain', false) generic_file.file ||= file generic_file.apply_depositor_metadata(user.user_key) generic_file.creator = user.name generic_file.date_uploaded = Date.today generic_file.date_modified = Date.today generic_file.batch = curation_concern generic_file.set_visibility(generic_file.visibility) generic_file.save! Sufia::GenericFile::Actions.create_content( generic_file, file, file.original_filename, 'content', user ) return generic_file end
Version data entries
7 entries across 7 versions & 1 rubygems