Sha256: df2e5934fda0a56863667c3fe3f1477b94d775fff323f3143a1ac5f5d44364c1

Contents?: true

Size: 971 Bytes

Versions: 36

Compression:

Stored size: 971 Bytes

Contents

require 'spec_helper'

describe Puppet::Settings::PathSetting do
  subject { described_class.new(:settings => double('settings'), :desc => "test") }

  context "#munge" do
    it "should expand all path elements" do
      munged = subject.munge("hello#{File::PATH_SEPARATOR}good/morning#{File::PATH_SEPARATOR}goodbye")
      munged.split(File::PATH_SEPARATOR).each do |p|
        expect(Puppet::Util).to be_absolute_path(p)
      end
    end

    it "should leave nil as nil" do
      expect(subject.munge(nil)).to be_nil
    end

    context "on Windows", :if => Puppet.features.microsoft_windows? do
      it "should convert \\ to /" do
        expect(subject.munge('C:\test\directory')).to eq('C:/test/directory')
      end

      it "should work with UNC paths" do
        expect(subject.munge('//localhost/some/path')).to eq('//localhost/some/path')
        expect(subject.munge('\\\\localhost\some\path')).to eq('//localhost/some/path')
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
puppet-5.5.22 spec/unit/settings/path_setting_spec.rb
puppet-5.5.22-x86-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-5.5.22-x64-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-5.5.22-universal-darwin spec/unit/settings/path_setting_spec.rb
puppet-5.5.21 spec/unit/settings/path_setting_spec.rb
puppet-5.5.21-x86-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-5.5.21-x64-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-5.5.21-universal-darwin spec/unit/settings/path_setting_spec.rb
puppet-5.5.20 spec/unit/settings/path_setting_spec.rb
puppet-5.5.20-x86-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-5.5.20-x64-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-5.5.20-universal-darwin spec/unit/settings/path_setting_spec.rb
puppet-5.5.19 spec/unit/settings/path_setting_spec.rb
puppet-5.5.19-x86-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-5.5.19-x64-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-5.5.19-universal-darwin spec/unit/settings/path_setting_spec.rb
puppet-5.5.18 spec/unit/settings/path_setting_spec.rb
puppet-5.5.18-x86-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-5.5.18-x64-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-5.5.18-universal-darwin spec/unit/settings/path_setting_spec.rb