Sha256: 840eac1a44e2f76f539b65f03bf7c0def3c086991d87c13af5bffdb5117d11b1

Contents?: true

Size: 967 Bytes

Versions: 63

Compression:

Stored size: 967 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|
        Puppet::Util.should be_absolute_path(p)
      end
    end

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

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

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

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
puppet-3.8.7 spec/unit/settings/path_setting_spec.rb
puppet-3.8.7-x86-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-3.8.7-x64-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-3.8.6 spec/unit/settings/path_setting_spec.rb
puppet-3.8.6-x86-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-3.8.6-x64-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-3.8.5 spec/unit/settings/path_setting_spec.rb
puppet-3.8.5-x86-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-3.8.5-x64-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-3.8.4 spec/unit/settings/path_setting_spec.rb
puppet-3.8.4-x86-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-3.8.4-x64-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-3.8.3 spec/unit/settings/path_setting_spec.rb
puppet-3.8.3-x86-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-3.8.3-x64-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-3.8.2 spec/unit/settings/path_setting_spec.rb
puppet-3.8.2-x86-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-3.8.2-x64-mingw32 spec/unit/settings/path_setting_spec.rb
puppet-3.8.1 spec/unit/settings/path_setting_spec.rb
puppet-3.8.1-x86-mingw32 spec/unit/settings/path_setting_spec.rb