Sha256: 73304c317fc719eb5ac9dd241ebf84384791dd661c9fc010a8bd1647452b6c70

Contents?: true

Size: 934 Bytes

Versions: 30

Compression:

Stored size: 934 Bytes

Contents

#! /usr/bin/env ruby
require 'spec_helper'

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

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

  before do
    Puppet::Util::Storage.stubs(:store)
  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)

    tidy = Puppet::Type.type(:tidy).new :path => dir, :recurse => true

    catalog = Puppet::Resource::Catalog.new
    catalog.add_resource(tidy)
    # avoid crude failures because of nil resources that result
    # from implicit containment and lacking containers
    catalog.stubs(:container_of).returns tidy

    catalog.apply

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

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
puppet-4.3.2 spec/integration/type/tidy_spec.rb
puppet-4.3.2-x86-mingw32 spec/integration/type/tidy_spec.rb
puppet-4.3.2-x64-mingw32 spec/integration/type/tidy_spec.rb
puppet-4.3.1 spec/integration/type/tidy_spec.rb
puppet-4.3.1-x86-mingw32 spec/integration/type/tidy_spec.rb
puppet-4.3.1-x64-mingw32 spec/integration/type/tidy_spec.rb
puppet-4.3.0 spec/integration/type/tidy_spec.rb
puppet-4.3.0-x86-mingw32 spec/integration/type/tidy_spec.rb
puppet-4.3.0-x64-mingw32 spec/integration/type/tidy_spec.rb
puppet-4.2.3 spec/integration/type/tidy_spec.rb
puppet-4.2.3-x86-mingw32 spec/integration/type/tidy_spec.rb
puppet-4.2.3-x64-mingw32 spec/integration/type/tidy_spec.rb
puppet-4.2.2 spec/integration/type/tidy_spec.rb
puppet-4.2.2-x86-mingw32 spec/integration/type/tidy_spec.rb
puppet-4.2.2-x64-mingw32 spec/integration/type/tidy_spec.rb
puppet-4.2.1 spec/integration/type/tidy_spec.rb
puppet-4.2.1-x86-mingw32 spec/integration/type/tidy_spec.rb
puppet-4.2.1-x64-mingw32 spec/integration/type/tidy_spec.rb
puppet-4.2.0 spec/integration/type/tidy_spec.rb
puppet-4.2.0-x86-mingw32 spec/integration/type/tidy_spec.rb