Sha256: 26873f1d21181a3c0fce1f015b9b8745c5c36bb3f9f8b146ae7399f63478ff9a

Contents?: true

Size: 964 Bytes

Versions: 4

Compression:

Stored size: 964 Bytes

Contents

#! /usr/bin/env ruby -S rspec
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

4 entries across 4 versions & 1 rubygems

Version Path
puppet-3.0.0.rc8 spec/unit/settings/path_setting_spec.rb
puppet-3.0.0.rc7 spec/unit/settings/path_setting_spec.rb
puppet-3.0.0.rc5 spec/unit/settings/path_setting_spec.rb
puppet-3.0.0.rc4 spec/unit/settings/path_setting_spec.rb