Sha256: c26202732fe4fa902d8abc304541bcb07c84462e0bb8bc62489f84c905683fd7

Contents?: true

Size: 997 Bytes

Versions: 3

Compression:

Stored size: 997 Bytes

Contents

require 'spec_helper'
require 'fileutils'
require 'furoshiki/zip'

describe Furoshiki::Zip::Directory do
  subject { Furoshiki::Zip::Directory.new input_dir, output_file }

  context "output file" do
    include_context 'zip'

    before :all do
      zip_directory = Furoshiki::Zip::Directory.new input_dir, @output_file
      zip_directory.write
      @zip = ::Zip::File.open @output_file
    end

    it "exists" do
      expect(@output_file).to exist
    end

    it "includes input directory without parents" do
      expect(@zip.entries.map(&:name)).to include(add_trailing_slash input_dir.basename)
    end

    relative_input_paths(input_dir.parent).each do |path|
      it "includes all children of input directory" do
        expect(@zip.entries.map(&:name)).to include(path)
      end
    end

    it "doesn't include extra files" do
      number_of_files = Dir.glob("#{input_dir}/**/*").push(input_dir).length
      expect(@zip.entries.length).to eq(number_of_files)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
furoshiki-0.3.1 spec/zip/directory_spec.rb
furoshiki-0.3.0 spec/zip/directory_spec.rb
furoshiki-0.2.0 spec/zip/directory_spec.rb