Sha256: 67138f850663edb740cb71c4811d62e8993fc3df6788bcf17a2c6b257dfc9f97

Contents?: true

Size: 987 Bytes

Versions: 44

Compression:

Stored size: 987 Bytes

Contents

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

describe Puppet::Settings::PathSetting do
  subject { described_class.new(:settings => mock('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

44 entries across 44 versions & 1 rubygems

Version Path
puppet-6.4.0 spec/unit/settings/path_setting_spec.rb
puppet-6.4.0-x86-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-6.4.0-x64-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-6.4.0-universal-darwin spec/unit/settings/path_setting_spec.rb
puppet-6.0.7 spec/unit/settings/path_setting_spec.rb
puppet-6.0.7-x86-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-6.0.7-x64-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-6.0.7-universal-darwin spec/unit/settings/path_setting_spec.rb
puppet-6.3.0 spec/unit/settings/path_setting_spec.rb
puppet-6.3.0-x86-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-6.3.0-x64-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-6.3.0-universal-darwin spec/unit/settings/path_setting_spec.rb
puppet-6.2.0 spec/unit/settings/path_setting_spec.rb
puppet-6.2.0-x86-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-6.2.0-x64-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-6.2.0-universal-darwin spec/unit/settings/path_setting_spec.rb
puppet-6.0.5 spec/unit/settings/path_setting_spec.rb
puppet-6.0.5-x86-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-6.0.5-x64-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-6.0.5-universal-darwin spec/unit/settings/path_setting_spec.rb