Sha256: 79f260091d1f981bd43c3c3a607a20ca1b23035a561160c287452514462b65b6

Contents?: true

Size: 929 Bytes

Versions: 39

Compression:

Stored size: 929 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

    Puppet::FileSystem.symlink?(link).should be_false
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
puppet-3.8.7 spec/integration/type/tidy_spec.rb
puppet-3.8.7-x86-mingw32 spec/integration/type/tidy_spec.rb
puppet-3.8.7-x64-mingw32 spec/integration/type/tidy_spec.rb
puppet-3.8.6 spec/integration/type/tidy_spec.rb
puppet-3.8.6-x86-mingw32 spec/integration/type/tidy_spec.rb
puppet-3.8.6-x64-mingw32 spec/integration/type/tidy_spec.rb
puppet-3.8.5 spec/integration/type/tidy_spec.rb
puppet-3.8.5-x86-mingw32 spec/integration/type/tidy_spec.rb
puppet-3.8.5-x64-mingw32 spec/integration/type/tidy_spec.rb
puppet-3.8.4 spec/integration/type/tidy_spec.rb
puppet-3.8.4-x86-mingw32 spec/integration/type/tidy_spec.rb
puppet-3.8.4-x64-mingw32 spec/integration/type/tidy_spec.rb
puppet-3.8.3 spec/integration/type/tidy_spec.rb
puppet-3.8.3-x86-mingw32 spec/integration/type/tidy_spec.rb
puppet-3.8.3-x64-mingw32 spec/integration/type/tidy_spec.rb
puppet-3.8.2 spec/integration/type/tidy_spec.rb
puppet-3.8.2-x86-mingw32 spec/integration/type/tidy_spec.rb
puppet-3.8.2-x64-mingw32 spec/integration/type/tidy_spec.rb
puppet-3.8.1 spec/integration/type/tidy_spec.rb
puppet-3.8.1-x86-mingw32 spec/integration/type/tidy_spec.rb