Sha256: 00f8123e8cfc82957b54145facbce5f39327d09673ca0467cde1b2923518135a

Contents?: true

Size: 1.2 KB

Versions: 9

Compression:

Stored size: 1.2 KB

Contents

# 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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
fedux_org-stdlib-0.11.18 spec/zipper_spec.rb
fedux_org-stdlib-0.11.17 spec/zipper_spec.rb
fedux_org-stdlib-0.11.16 spec/zipper_spec.rb
fedux_org-stdlib-0.11.15 spec/zipper_spec.rb
fedux_org-stdlib-0.11.14 spec/zipper_spec.rb
fedux_org-stdlib-0.11.12 spec/zipper_spec.rb
fedux_org-stdlib-0.11.11 spec/zipper_spec.rb
fedux_org-stdlib-0.11.9 spec/zipper_spec.rb
fedux_org-stdlib-0.11.8 spec/zipper_spec.rb