Update stdlib and concat to 6.1.0 both
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / spec / functions / sort_spec.rb
1 require 'spec_helper'
2
3 describe 'sort', :if => Puppet::Util::Package.versioncmp(Puppet.version, '6.0.0') < 0 do
4   describe 'signature validation' do
5     it { is_expected.not_to eq(nil) }
6     it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) }
7     it { is_expected.to run.with_params([], 'extra').and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) }
8     it {
9       pending('stricter input checking')
10       is_expected.to run.with_params({}).and_raise_error(Puppet::ParseError, %r{requires string or array})
11     }
12     it {
13       pending('stricter input checking')
14       is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError, %r{requires string or array})
15     }
16     it {
17       pending('stricter input checking')
18       is_expected.to run.with_params(true).and_raise_error(Puppet::ParseError, %r{requires string or array})
19     }
20   end
21
22   context 'when called with an array' do
23     it { is_expected.to run.with_params([]).and_return([]) }
24     it { is_expected.to run.with_params(['a']).and_return(['a']) }
25     it { is_expected.to run.with_params(['c', 'b', 'a']).and_return(['a', 'b', 'c']) }
26   end
27
28   context 'when called with a string' do
29     it { is_expected.to run.with_params('').and_return('') }
30     it { is_expected.to run.with_params('a').and_return('a') }
31     it { is_expected.to run.with_params('cbda').and_return('abcd') }
32   end
33
34   context 'when called with a number' do
35     it { is_expected.to run.with_params('9478').and_return('4789') }
36   end
37 end