Sha256: c0dbbdfdabaa63f2c0036ccd14c5083f4305fb99052fe158dcd8c29b524d5df1

Contents?: true

Size: 955 Bytes

Versions: 29

Compression:

Stored size: 955 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('//server/some/path').should == '//server/some/path'
        subject.munge('\\\\server\some\path').should == '//server/some/path'
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 2 rubygems

Version Path
puppet-3.3.2 spec/unit/settings/path_setting_spec.rb
puppet-3.3.1 spec/unit/settings/path_setting_spec.rb
puppet-3.3.1.rc3 spec/unit/settings/path_setting_spec.rb
puppet-3.3.1.rc2 spec/unit/settings/path_setting_spec.rb
puppet-3.3.1.rc1 spec/unit/settings/path_setting_spec.rb
puppet-3.3.0 spec/unit/settings/path_setting_spec.rb
puppet-3.3.0.rc3 spec/unit/settings/path_setting_spec.rb
puppet-3.3.0.rc2 spec/unit/settings/path_setting_spec.rb
puppet-3.2.4 spec/unit/settings/path_setting_spec.rb
puppet-3.2.3 spec/unit/settings/path_setting_spec.rb
puppet-3.2.3.rc1 spec/unit/settings/path_setting_spec.rb
puppet-3.2.2 spec/unit/settings/path_setting_spec.rb
puppet-3.2.1 spec/unit/settings/path_setting_spec.rb
puppet-3.2.1.rc1 spec/unit/settings/path_setting_spec.rb
puppet-3.2.0.rc2 spec/unit/settings/path_setting_spec.rb
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/puppet-3.1.0/spec/unit/settings/path_setting_spec.rb
puppet-3.2.0.rc1 spec/unit/settings/path_setting_spec.rb
puppet-3.1.1 spec/unit/settings/path_setting_spec.rb
librarian-puppet-0.9.8 vendor/gems/ruby/1.9.1/gems/puppet-3.1.0/spec/unit/settings/path_setting_spec.rb
puppet-3.1.0 spec/unit/settings/path_setting_spec.rb