describe 'delete' do
it { is_expected.not_to eq(nil) }
- it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError) }
- it { is_expected.to run.with_params([]).and_raise_error(Puppet::ParseError) }
+ it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError, %r{Wrong number of arguments}) }
+ it { is_expected.to run.with_params([]).and_raise_error(Puppet::ParseError, %r{Wrong number of arguments}) }
it { is_expected.to run.with_params([], 'two') }
- it { is_expected.to run.with_params([], 'two', 'three').and_raise_error(Puppet::ParseError) }
- it { is_expected.to run.with_params(1, 'two').and_raise_error(TypeError) }
+ it { is_expected.to run.with_params([], 'two', 'three').and_raise_error(Puppet::ParseError, %r{Wrong number of arguments}) }
+ it { is_expected.to run.with_params(1, 'two').and_raise_error(TypeError, %r{First argument must be an Array, String, or Hash}) }
describe 'deleting from an array' do
it { is_expected.to run.with_params([], '').and_return([]) }
describe 'deleting from an array' do
it { is_expected.to run.with_params({}, '').and_return({}) }
it { is_expected.to run.with_params({}, 'key').and_return({}) }
- it { is_expected.to run.with_params({'key' => 'value'}, 'key').and_return({}) }
- it { is_expected.to run \
- .with_params({'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3'}, 'key2') \
- .and_return( {'key1' => 'value1', 'key3' => 'value3'})
+ it { is_expected.to run.with_params({ 'key' => 'value' }, 'key').and_return({}) }
+ it {
+ is_expected.to run \
+ .with_params({ 'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3' }, 'key2') \
+ .and_return('key1' => 'value1', 'key3' => 'value3')
}
- it { is_expected.to run \
- .with_params({'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3'}, ['key1', 'key2']) \
- .and_return( {'key3' => 'value3'})
+ it {
+ is_expected.to run \
+ .with_params({ 'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3' }, ['key1', 'key2']) \
+ .and_return('key3' => 'value3')
}
- it { is_expected.to run \
- .with_params({'ĸəұ1' => 'νãŀủĕ1', 'ĸəұ2' => 'νãŀủĕ2', 'ĸəұ3' => 'νãŀủĕ3'}, ['ĸəұ1', 'ĸəұ2']) \
- .and_return( {'ĸəұ3' => 'νãŀủĕ3'})
+ it {
+ is_expected.to run \
+ .with_params({ 'ĸəұ1' => 'νãŀủĕ1', 'ĸəұ2' => 'νãŀủĕ2', 'ĸəұ3' => 'νãŀủĕ3' }, ['ĸəұ1', 'ĸəұ2']) \
+ .and_return('ĸəұ3' => 'νãŀủĕ3')
}
end
- it "should leave the original array intact" do
- argument1 = ['one','two','three']
+ it 'leaves the original array intact' do
+ argument1 = ['one', 'two', 'three']
original1 = argument1.dup
- result = subject.call([argument1,'two'])
+ _result = subject.execute(argument1, 'two')
expect(argument1).to eq(original1)
end
- it "should leave the original string intact" do
+ it 'leaves the original string intact' do
argument1 = 'onetwothree'
original1 = argument1.dup
- result = subject.call([argument1,'two'])
+ _result = subject.execute(argument1, 'two')
expect(argument1).to eq(original1)
end
- it "should leave the original hash intact" do
- argument1 = {'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3'}
+ it 'leaves the original hash intact' do
+ argument1 = { 'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3' }
original1 = argument1.dup
- result = subject.call([argument1,'key2'])
+ _result = subject.execute(argument1, 'key2')
expect(argument1).to eq(original1)
end
end