4 it { is_expected.not_to eq(nil) }
5 it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError) }
6 it { is_expected.to run.with_params([]).and_raise_error(Puppet::ParseError) }
7 it { is_expected.to run.with_params([], 'two') }
8 it { is_expected.to run.with_params([], 'two', 'three').and_raise_error(Puppet::ParseError) }
9 it { is_expected.to run.with_params(1, 'two').and_raise_error(TypeError) }
11 describe 'deleting from an array' do
12 it { is_expected.to run.with_params([], '').and_return([]) }
13 it { is_expected.to run.with_params([], 'two').and_return([]) }
14 it { is_expected.to run.with_params(['two'], 'two').and_return([]) }
15 it { is_expected.to run.with_params(['two', 'two'], 'two').and_return([]) }
16 it { is_expected.to run.with_params(['ab', 'b', 'c', 'b'], 'b').and_return(['ab', 'c']) }
17 it { is_expected.to run.with_params(['one', 'two', 'three'], 'four').and_return(['one', 'two', 'three']) }
18 it { is_expected.to run.with_params(['one', 'two', 'three'], 'e').and_return(['one', 'two', 'three']) }
19 it { is_expected.to run.with_params(['one', 'two', 'three'], 'two').and_return(['one', 'three']) }
20 it { is_expected.to run.with_params(['two', 'one', 'two', 'three', 'two'], 'two').and_return(['one', 'three']) }
21 it { is_expected.to run.with_params(['one', 'two', 'three', 'two'], ['one', 'two']).and_return(['three']) }
22 it { is_expected.to run.with_params(['ồאּẻ', 'ŧẅơ', 'ŧңŗё℮', 'ŧẅơ'], ['ồאּẻ', 'ŧẅơ']).and_return(['ŧңŗё℮']) }
25 describe 'deleting from a string' do
26 it { is_expected.to run.with_params('', '').and_return('') }
27 it { is_expected.to run.with_params('bar', '').and_return('bar') }
28 it { is_expected.to run.with_params('', 'bar').and_return('') }
29 it { is_expected.to run.with_params('bar', 'bar').and_return('') }
30 it { is_expected.to run.with_params('barbar', 'bar').and_return('') }
31 it { is_expected.to run.with_params('barfoobar', 'bar').and_return('foo') }
32 it { is_expected.to run.with_params('foobarbabarz', 'bar').and_return('foobaz') }
33 it { is_expected.to run.with_params('foobarbabarz', ['foo', 'bar']).and_return('baz') }
34 it { is_expected.to run.with_params('ƒōōβậяβậβậяź', ['ƒōō', 'βậя']).and_return('βậź') }
36 it { is_expected.to run.with_params('barfoobar', ['barbar', 'foo']).and_return('barbar') }
37 it { is_expected.to run.with_params('barfoobar', ['foo', 'barbar']).and_return('') }
40 describe 'deleting from an array' do
41 it { is_expected.to run.with_params({}, '').and_return({}) }
42 it { is_expected.to run.with_params({}, 'key').and_return({}) }
43 it { is_expected.to run.with_params({'key' => 'value'}, 'key').and_return({}) }
44 it { is_expected.to run \
45 .with_params({'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3'}, 'key2') \
46 .and_return( {'key1' => 'value1', 'key3' => 'value3'})
48 it { is_expected.to run \
49 .with_params({'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3'}, ['key1', 'key2']) \
50 .and_return( {'key3' => 'value3'})
52 it { is_expected.to run \
53 .with_params({'ĸəұ1' => 'νãŀủĕ1', 'ĸəұ2' => 'νãŀủĕ2', 'ĸəұ3' => 'νãŀủĕ3'}, ['ĸəұ1', 'ĸəұ2']) \
54 .and_return( {'ĸəұ3' => 'νãŀủĕ3'})
58 it "should leave the original array intact" do
59 argument1 = ['one','two','three']
60 original1 = argument1.dup
61 result = subject.call([argument1,'two'])
62 expect(argument1).to eq(original1)
64 it "should leave the original string intact" do
65 argument1 = 'onetwothree'
66 original1 = argument1.dup
67 result = subject.call([argument1,'two'])
68 expect(argument1).to eq(original1)
70 it "should leave the original hash intact" do
71 argument1 = {'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3'}
72 original1 = argument1.dup
73 result = subject.call([argument1,'key2'])
74 expect(argument1).to eq(original1)