File: path_join_spec.rb

package info (click to toggle)
puppet-module-extlib 7.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 420 kB
  • sloc: ruby: 1,035; sh: 15; makefile: 10
file content (51 lines) | stat: -rw-r--r-- 1,214 bytes parent folder | download
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