Sha256: d17e5e5481a16160fbf1c4a77e52677a76c8713225e52fc1af7ec99e5ec4379c

Contents?: true

Size: 1.28 KB

Versions: 5

Compression:

Stored size: 1.28 KB

Contents

require 'spec_helper'
require 'r10k/tarball'

describe R10K::Tarball do
  include_context 'Tarball'

  subject { described_class.new('fixture-tarball', fixture_tarball, checksum: fixture_checksum) }

  describe 'initialization' do
    it 'initializes' do
      expect(subject).to be_kind_of(described_class)
    end
  end

  describe 'downloading and caching' do
    it 'downloads the source to the cache' do
      # No cache present initially
      expect(File.exist?(subject.cache_path)).to be(false)
      expect(subject.cache_valid?).to be(false)

      subject.get

      expect(subject.cache_valid?).to be(true)
      expect(File.exist?(subject.cache_path)).to be(true)
    end

    let(:raw_content) {[
      './',
      './Puppetfile',
      './metadata.json',
      './spec/',
      './environment.conf',
      './spec/1',
    ]}

    let(:clean_content) {[
      'Puppetfile',
      'metadata.json',
      'spec',
      'environment.conf',
      'spec/1',
    ]}

    it 'returns clean paths when listing cached tarball content' do
      iterator = allow(subject).to receive(:each_tarball_entry)
      raw_content.each { |entry| iterator.and_yield(entry) }

      expect(subject.paths).to eq(clean_content)
    end
  end

  describe 'http sources'

  describe 'file sources'

  describe 'syncing'
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
r10k-3.15.0 spec/unit/tarball_spec.rb
akerl-r10k-3.14.2.1 spec/unit/tarball_spec.rb
r10k-3.14.2 spec/unit/tarball_spec.rb
r10k-3.14.1 spec/unit/tarball_spec.rb
r10k-3.14.0 spec/unit/tarball_spec.rb