Sha256: 3d7cc51d4d51fa5e374ff4e4d0f2b12c7598b0673694412d98bf030ddde145c1

Contents?: true

Size: 1.35 KB

Versions: 9

Compression:

Stored size: 1.35 KB

Contents

require 'spec_helper'

describe Minimart::Utils::Archive do
  describe '::extract_archive' do
    let(:archive) { 'spec/fixtures/sample_cookbook.tar.gz' }

    let(:extracted_readme) do
      File.join(test_directory, 'sample_cookbook', 'README.md')
    end

    it 'should extract the contents of the archive to the passed in dir' do
      Minimart::Utils::Archive.extract_archive(archive, test_directory)
      expect(test_directory_contents).to include extracted_readme
    end
  end

  describe '::pack_archive' do
    let(:path) { File.expand_path('spec/fixtures/sample_cookbook') }
    let(:cookbook) { Minimart::Cookbook.from_path(path) }
    let(:archive) { File.expand_path(File.join(test_directory, 'sample.tar.gz')) }

    before(:each) { Minimart::Utils::Archive.pack_archive(cookbook, archive) }

    it 'should create the archive' do
      expect(File.exists?(archive)).to eq true
    end

    it 'should create a directory of the cookbook name in the top level of the archive' do
      Minimart::Utils::Archive.extract_archive(archive, test_directory)
      expect(Dir.exists?(File.join(test_directory, 'sample_cookbook')))
    end

    it 'should properly compress any files' do
      Minimart::Utils::Archive.extract_archive(archive, test_directory)
      expect(File.exists?(File.join(test_directory, 'sample_cookbook', 'README.md'))).to eq true
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
minimart-1.2.5 spec/lib/minimart/utils/archive_spec.rb
minimart-1.2.4 spec/lib/minimart/utils/archive_spec.rb
minimart-1.2.3 spec/lib/minimart/utils/archive_spec.rb
minimart-1.2.0 spec/lib/minimart/utils/archive_spec.rb
minimart-1.1.6 spec/lib/minimart/utils/archive_spec.rb
minimart-1.1.3 spec/lib/minimart/utils/archive_spec.rb
minimart-1.0.2 spec/lib/minimart/utils/archive_spec.rb
minimart-1.0.1 spec/lib/minimart/utils/archive_spec.rb
minimart-0.0.1 spec/lib/minimart/utils/archive_spec.rb