Sha256: 3d2e97dacfa726e62bf5b218bf280e1b413c1c41021ad4c43b5ebcf9f48457ec
Contents?: true
Size: 983 Bytes
Versions: 3
Compression:
Stored size: 983 Bytes
Contents
require File.expand_path('../file_helpers', __FILE__) module ComponentHelpers include FileHelpers def setup_component(file_name) setup_file file_name end def cleanup_components cleanup_files 'components' end def create_zip(name) fname = Rails.root.join('public', 'cms', 'temp').join(name) FileUtils.mkdir_p File.dirname(fname) begin Zip::ZipFile.open(fname, Zip::ZipFile::CREATE) do |zipfile| zipfile.get_output_stream("test.txt") {} zipfile.get_output_stream("test.exe") {} # invalid file ext will be ignored zipfile.mkdir("dir") zipfile.get_output_stream("dir/test.exe") {} zipfile.get_output_stream("dir/test.txt") {} zipfile.get_output_stream("../../dir/test.exe") {} # relative path file will be ignored zipfile.get_output_stream("../../dir/test.txt") {} # relative path file will be ignored end yield fname ensure cleanup_files 'temp' end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
liquid_cms-0.2.2.0 | test/test_helpers/component_helpers.rb |
liquid_cms-0.2.1.1 | test/test_helpers/component_helpers.rb |
liquid_cms-0.2.1.0 | test/test_helpers/component_helpers.rb |