# encoding: utf-8 require 'spec_helper' require 'fedux_org_stdlib/zipper' RSpec.describe FeduxOrgStdlib::Zipper do context '#zip' do it 'creates a zip file' do create_dir 'source' source_directory = absolute_path('source/') destination_file = absolute_path('source.zip') FeduxOrgStdlib::Zipper.zip(source_directory, destination_file) expect(File.exist?(destination_file)).to be true end it 'handles a source directory with files a root level' do write_file('source/file', 'text') source_directory = absolute_path('source/') destination_file = absolute_path('source.zip') FeduxOrgStdlib::Zipper.zip(source_directory, destination_file) expect(File.exist?(destination_file)).to be true end end context '#unzip' do it 'unzips zip file' do write_file 'unzip.d/file', 'text' source_directory = absolute_path('unzip.d') zip_file = absolute_path('unzip.d.zip') FeduxOrgStdlib::Zipper.zip(source_directory, zip_file) destination_directory = absolute_path('destination.d') FeduxOrgStdlib::Zipper.unzip(zip_file, destination_directory) expect(File.exist?(destination_directory)).to be true end end end