Sha256: bdacf7065b8895306d5003ce6e679988ecf82486d2287c398c55b059129d5e82

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

describe FakeZip do
  extend MyTemp.new(:temp, 'tmp/testing.zip')

  describe '.new' do
    it 'takes file name and yaml string' do
      expect { FakeZip.new temp, '{}' }.to change { File.exist? temp }.from(false).to(true)
    end

    it 'takes file name and hash' do
      expect { FakeZip.new temp, {} }.to change { File.exist? temp }.from(false).to(true)
    end
  end

  describe 'examples (given structure --- files in archive)' do
    examples = <<-END.lines.map(&:strip).map { |x| x.split(' --- ',2).map { |x| eval x } }
      "[]"       --- []
      {}         --- []
      {root: []} --- ['root/']
      "root: []" --- ['root/']
      'root_dir: [file1, file2, nested_dir: [nested_file.any], empty_dir: []]' ---  ["root_dir/", "root_dir/nested_dir/", "root_dir/empty_dir/", "root_dir/file1", "root_dir/file2", "root_dir/nested_dir/nested_file.any"] 
    END

    examples.each do |input,output|
      specify "#{input.inspect} --- #{output.inspect}" do
        FakeZip.new(temp, input)
        zip_entries(temp).should == output
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fake_zip-0.0.1 spec/examples_spec.rb