1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
# frozen_string_literal: true
require 'spec_helper'
describe 'extlib::path_join' do
describe 'windows' do
let(:dirs) do
['c:', 'tmp', 'test', 'test.txt']
end
let(:facts) do
{
kernel: 'windows'
}
end
it { is_expected.to run.with_params(dirs).and_return('/c/tmp/test/test.txt') }
it { is_expected.to run.with_params(['c:\\windows\\puppetlabs\\puppet\\embedded\\gems']).and_return('/c/windows/puppetlabs/puppet/embedded/gems') }
it { is_expected.to run.with_params(['/c']).and_return('/c') }
end
describe 'not_windows' do
let(:dirs) do
['/tmp', 'test', 'test']
end
let(:facts) do
{
kernel: 'linux'
}
end
it { is_expected.to run.with_params(dirs).and_return('/tmp/test/test') }
it { is_expected.to run.with_params(['/tmp']).and_return('/tmp') }
end
describe 'multiple dirs with comma' do
let(:dirs) do
['/tmp', 'test', 'test']
end
let(:facts) do
{
kernel: 'linux'
}
end
it { is_expected.to run.with_params(dirs).and_return('/tmp/test/test') }
it { is_expected.to run.with_params('/tmp', 'test', 'test').and_return('/tmp/test/test') }
end
end
|