Sha256: 6b05fc749f75388708ce70d887225d484329ce1392a3f2b67118089dd11456f4

Contents?: true

Size: 1.09 KB

Versions: 340

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'

require 'puppet_spec/compiler'
require 'puppet_spec/files'
require 'puppet/file_bucket/dipper'

describe Puppet::Type.type(:tidy) do
  include PuppetSpec::Files
  include PuppetSpec::Compiler

  before do
    allow(Puppet::Util::Storage).to receive(:store)
  end

  it "should be able to recursively remove directories" do
    dir = tmpfile("tidy_testing")
    FileUtils.mkdir_p(File.join(dir, "foo", "bar"))

    apply_compiled_manifest(<<-MANIFEST)
      tidy { '#{dir}':
        recurse => true,
        rmdirs  => true,
      }
    MANIFEST

    expect(Puppet::FileSystem.directory?(dir)).to be_falsey
  end

  # Testing #355.
  it "should be able to remove dead links", :if => Puppet.features.manages_symlinks? do
    dir = tmpfile("tidy_link_testing")
    link = File.join(dir, "link")
    target = tmpfile("no_such_file_tidy_link_testing")
    Dir.mkdir(dir)
    Puppet::FileSystem.symlink(target, link)

    apply_compiled_manifest(<<-MANIFEST)
      tidy { '#{dir}':
        recurse => true,
      }
    MANIFEST

    expect(Puppet::FileSystem.symlink?(link)).to be_falsey
  end
end

Version data entries

340 entries across 340 versions & 1 rubygems

Version Path
puppet-8.3.0 spec/integration/type/tidy_spec.rb
puppet-8.3.0-x86-mingw32 spec/integration/type/tidy_spec.rb
puppet-8.3.0-x64-mingw32 spec/integration/type/tidy_spec.rb
puppet-8.3.0-universal-darwin spec/integration/type/tidy_spec.rb
puppet-8.4.0 spec/integration/type/tidy_spec.rb
puppet-8.4.0-x86-mingw32 spec/integration/type/tidy_spec.rb
puppet-8.4.0-x64-mingw32 spec/integration/type/tidy_spec.rb
puppet-8.4.0-universal-darwin spec/integration/type/tidy_spec.rb
puppet-7.28.0 spec/integration/type/tidy_spec.rb
puppet-7.28.0-x86-mingw32 spec/integration/type/tidy_spec.rb
puppet-7.28.0-x64-mingw32 spec/integration/type/tidy_spec.rb
puppet-7.28.0-universal-darwin spec/integration/type/tidy_spec.rb
puppet-8.3.1 spec/integration/type/tidy_spec.rb
puppet-8.3.1-x86-mingw32 spec/integration/type/tidy_spec.rb
puppet-8.3.1-x64-mingw32 spec/integration/type/tidy_spec.rb
puppet-8.3.1-universal-darwin spec/integration/type/tidy_spec.rb
puppet-7.27.0 spec/integration/type/tidy_spec.rb
puppet-7.27.0-x86-mingw32 spec/integration/type/tidy_spec.rb
puppet-7.27.0-x64-mingw32 spec/integration/type/tidy_spec.rb
puppet-7.27.0-universal-darwin spec/integration/type/tidy_spec.rb