Sha256: 5d9228ee5ab211382db3129e8703d45d3398a8e13b556a301355bccbb4808429

Contents?: true

Size: 968 Bytes

Versions: 304

Compression:

Stored size: 968 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::Util::Platform.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

304 entries across 304 versions & 1 rubygems

Version Path
puppet-8.3.0 spec/unit/settings/path_setting_spec.rb
puppet-8.3.0-x86-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-8.3.0-x64-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-8.3.0-universal-darwin spec/unit/settings/path_setting_spec.rb
puppet-8.4.0 spec/unit/settings/path_setting_spec.rb
puppet-8.4.0-x86-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-8.4.0-x64-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-8.4.0-universal-darwin spec/unit/settings/path_setting_spec.rb
puppet-7.28.0 spec/unit/settings/path_setting_spec.rb
puppet-7.28.0-x86-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-7.28.0-x64-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-7.28.0-universal-darwin spec/unit/settings/path_setting_spec.rb
puppet-8.3.1 spec/unit/settings/path_setting_spec.rb
puppet-8.3.1-x86-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-8.3.1-x64-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-8.3.1-universal-darwin spec/unit/settings/path_setting_spec.rb
puppet-7.27.0 spec/unit/settings/path_setting_spec.rb
puppet-7.27.0-x86-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-7.27.0-x64-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-7.27.0-universal-darwin spec/unit/settings/path_setting_spec.rb