Sha256: b026d6cb3d238d25e506433f95d1c6c7062b49caed04a4997587e4e3be743566

Contents?: true

Size: 1.18 KB

Versions: 47

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'
require 'puppet/module_tool/tar'

describe Puppet::ModuleTool::Tar do

  it "uses tar when present and not on Windows" do
    Facter.stubs(:value).with('osfamily').returns 'ObscureLinuxDistro'
    Puppet::Util.stubs(:which).with('tar').returns '/usr/bin/tar'
    Puppet::Util::Platform.stubs(:windows?).returns false

    described_class.instance.should be_a_kind_of Puppet::ModuleTool::Tar::Gnu
  end

  it "falls back to minitar when it and zlib are present" do
    Facter.stubs(:value).with('osfamily').returns 'Windows'
    Puppet::Util.stubs(:which).with('tar')
    Puppet::Util::Platform.stubs(:windows?).returns true
    Puppet.stubs(:features).returns(stub(:minitar? => true, :zlib? => true))

    described_class.instance.should be_a_kind_of Puppet::ModuleTool::Tar::Mini
  end

  it "fails when there is no possible implementation" do
    Facter.stubs(:value).with('osfamily').returns 'Windows'
    Puppet::Util.stubs(:which).with('tar')
    Puppet::Util::Platform.stubs(:windows?).returns true
    Puppet.stubs(:features).returns(stub(:minitar? => false, :zlib? => false))

    expect { described_class.instance }.to raise_error RuntimeError, /No suitable tar/
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
puppet-3.8.7 spec/unit/module_tool/tar_spec.rb
puppet-3.8.7-x86-mingw32 spec/unit/module_tool/tar_spec.rb
puppet-3.8.7-x64-mingw32 spec/unit/module_tool/tar_spec.rb
puppet-3.8.6 spec/unit/module_tool/tar_spec.rb
puppet-3.8.6-x86-mingw32 spec/unit/module_tool/tar_spec.rb
puppet-3.8.6-x64-mingw32 spec/unit/module_tool/tar_spec.rb
puppet-3.8.5 spec/unit/module_tool/tar_spec.rb
puppet-3.8.5-x86-mingw32 spec/unit/module_tool/tar_spec.rb
puppet-3.8.5-x64-mingw32 spec/unit/module_tool/tar_spec.rb
puppet-3.8.4 spec/unit/module_tool/tar_spec.rb
puppet-3.8.4-x86-mingw32 spec/unit/module_tool/tar_spec.rb
puppet-3.8.4-x64-mingw32 spec/unit/module_tool/tar_spec.rb
puppet-3.8.3 spec/unit/module_tool/tar_spec.rb
puppet-3.8.3-x86-mingw32 spec/unit/module_tool/tar_spec.rb
puppet-3.8.3-x64-mingw32 spec/unit/module_tool/tar_spec.rb
puppet-3.8.2 spec/unit/module_tool/tar_spec.rb
puppet-3.8.2-x86-mingw32 spec/unit/module_tool/tar_spec.rb
puppet-3.8.2-x64-mingw32 spec/unit/module_tool/tar_spec.rb
puppet-3.8.1 spec/unit/module_tool/tar_spec.rb
puppet-3.8.1-x86-mingw32 spec/unit/module_tool/tar_spec.rb