X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Fstdlib%2Fspec%2Ffunctions%2Fdelete_regex_spec.rb;fp=3rdparty%2Fmodules%2Fstdlib%2Fspec%2Ffunctions%2Fdelete_regex_spec.rb;h=ff21d310c2712a6a55c898bc3216b2f0f7872100;hb=131e09855e065be940e104d9ab0f18940cc76257;hp=f27a9467b08946df6cf5afb811f82109292456c6;hpb=407d322498f4fde815abf381007fbecfe5c10b2b;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/stdlib/spec/functions/delete_regex_spec.rb b/3rdparty/modules/stdlib/spec/functions/delete_regex_spec.rb old mode 100755 new mode 100644 index f27a9467b..ff21d310c --- a/3rdparty/modules/stdlib/spec/functions/delete_regex_spec.rb +++ b/3rdparty/modules/stdlib/spec/functions/delete_regex_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe 'delete_regex' 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) } it { is_expected.to run.with_params([], 'two') } it { is_expected.to run.with_params({}, 'two') } @@ -28,27 +28,29 @@ describe 'delete_regex' do 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') } 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 - subject.call([argument1,'two']) + 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 - subject.call([argument1,'key2']) + subject.execute(argument1, 'key2') expect(argument1).to eq(original1) end end