X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Fstdlib%2Fspec%2Ffunctions%2Frange_spec.rb;h=7b9e6d43cc2918a207c87fc32aa0aae335532e50;hb=131e09855e065be940e104d9ab0f18940cc76257;hp=ca569d5d4a15a199dafee0f960ed1350c5798428;hpb=407d322498f4fde815abf381007fbecfe5c10b2b;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/stdlib/spec/functions/range_spec.rb b/3rdparty/modules/stdlib/spec/functions/range_spec.rb old mode 100755 new mode 100644 index ca569d5d4..7b9e6d43c --- a/3rdparty/modules/stdlib/spec/functions/range_spec.rb +++ b/3rdparty/modules/stdlib/spec/functions/range_spec.rb @@ -4,28 +4,59 @@ describe 'range' do it { is_expected.not_to eq(nil) } describe 'signature validation in puppet3', :unless => RSpec.configuration.puppet_future do - it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) } + it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) } it { - pending("Current implementation ignores parameters after the third.") - is_expected.to run.with_params(1, 2, 3, 4).and_raise_error(Puppet::ParseError, /wrong number of arguments/i) + pending('Current implementation ignores parameters after the third.') + is_expected.to run.with_params(1, 2, 3, 4).and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) } - it { is_expected.to run.with_params('1..2..3').and_raise_error(Puppet::ParseError, /Unable to compute range/i) } - it { is_expected.to run.with_params('').and_raise_error(Puppet::ParseError, /Unknown range format/i) } + it { is_expected.to run.with_params('1..2..3').and_raise_error(Puppet::ParseError, %r{Unable to compute range}i) } + it { is_expected.to run.with_params('').and_raise_error(Puppet::ParseError, %r{Unknown range format}i) } end describe 'signature validation in puppet4', :if => RSpec.configuration.puppet_future do - it { pending "the puppet 4 implementation"; is_expected.to run.with_params().and_raise_error(ArgumentError) } - it { pending "the puppet 4 implementation"; is_expected.to run.with_params('').and_raise_error(ArgumentError) } - it { pending "the puppet 4 implementation"; is_expected.to run.with_params({}).and_raise_error(ArgumentError) } - it { pending "the puppet 4 implementation"; is_expected.to run.with_params([]).and_raise_error(ArgumentError) } - it { pending "the puppet 4 implementation"; is_expected.to run.with_params(true).and_raise_error(ArgumentError) } - it { pending "the puppet 4 implementation"; is_expected.to run.with_params(true).and_raise_error(ArgumentError) } - it { is_expected.to run.with_params(1, 2, 'foo').and_raise_error(ArgumentError) } - it { pending "the puppet 4 implementation"; is_expected.to run.with_params(1, 2, []).and_raise_error(ArgumentError) } - it { pending "the puppet 4 implementation"; is_expected.to run.with_params(1, 2, {}).and_raise_error(ArgumentError) } - it { pending "the puppet 4 implementation"; is_expected.to run.with_params(1, 2, true).and_raise_error(ArgumentError) } - it { pending "the puppet 4 implementation"; is_expected.to run.with_params(1, 2, 3, 4).and_raise_error(ArgumentError) } - it { pending "the puppet 4 implementation"; is_expected.to run.with_params('1..2..3').and_raise_error(ArgumentError) } + it { + pending 'the puppet 4 implementation' + is_expected.to run.with_params.and_raise_error(ArgumentError) + } + it { + pending 'the puppet 4 implementation' + is_expected.to run.with_params('').and_raise_error(ArgumentError) + } + it { + pending 'the puppet 4 implementation' + is_expected.to run.with_params({}).and_raise_error(ArgumentError) + } + it { + pending 'the puppet 4 implementation' + is_expected.to run.with_params([]).and_raise_error(ArgumentError) + } + it { + pending 'the puppet 4 implementation' + is_expected.to run.with_params(true).and_raise_error(ArgumentError) + } + it { + is_expected.to run.with_params(1, 2, 'foo').and_raise_error(ArgumentError) + } + it { + pending 'the puppet 4 implementation' + is_expected.to run.with_params(1, 2, []).and_raise_error(ArgumentError) + } + it { + pending 'the puppet 4 implementation' + is_expected.to run.with_params(1, 2, {}).and_raise_error(ArgumentError) + } + it { + pending 'the puppet 4 implementation' + is_expected.to run.with_params(1, 2, true).and_raise_error(ArgumentError) + } + it { + pending 'the puppet 4 implementation' + is_expected.to run.with_params(1, 2, 3, 4).and_raise_error(ArgumentError) + } + it { + pending 'the puppet 4 implementation' + is_expected.to run.with_params('1..2..3').and_raise_error(ArgumentError) + } end context 'with characters as bounds' do @@ -111,16 +142,16 @@ describe 'range' do describe 'when passing mixed arguments as bounds' do it { - pending('these bounds should not be allowed as ruby will OOM hard. e.g. `(\'host0\'..\'hosta\').to_a` has 3239930 elements on ruby 1.9, adding more \'0\'s and \'a\'s increases that exponentially') - is_expected.to run.with_params('0', 'a').and_raise_error(Puppet::ParseError, /cannot interpolate between numeric and non-numeric bounds/) + pending('these bounds should not be allowed as ruby will OOM hard. e.g. `(\'host0\'..\'hosta\').to_a` has 3239930 elements on ruby 1.9, adding more \'0\'s and \'a\'s increases that exponentially') # rubocop:disable Metrics/LineLength : unable to cut line to required length + is_expected.to run.with_params('0', 'a').and_raise_error(Puppet::ParseError, %r{cannot interpolate between numeric and non-numeric bounds}) } it { - pending('these bounds should not be allowed as ruby will OOM hard. e.g. `(\'host0\'..\'hosta\').to_a` has 3239930 elements on ruby 1.9, adding more \'0\'s and \'a\'s increases that exponentially') - is_expected.to run.with_params(0, 'a').and_raise_error(Puppet::ParseError, /cannot interpolate between numeric and non-numeric bounds/) + pending('these bounds should not be allowed as ruby will OOM hard. e.g. `(\'host0\'..\'hosta\').to_a` has 3239930 elements on ruby 1.9, adding more \'0\'s and \'a\'s increases that exponentially') # rubocop:disable Metrics/LineLength : unable to cut line to required length + is_expected.to run.with_params(0, 'a').and_raise_error(Puppet::ParseError, %r{cannot interpolate between numeric and non-numeric bounds}) } it { - pending('these bounds should not be allowed as ruby will OOM hard. e.g. `(\'host0\'..\'hosta\').to_a` has 3239930 elements on ruby 1.9, adding more \'0\'s and \'a\'s increases that exponentially') - is_expected.to run.with_params('h0', 'ha').and_raise_error(Puppet::ParseError, /cannot interpolate between numeric and non-numeric bounds/) + pending('these bounds should not be allowed as ruby will OOM hard. e.g. `(\'host0\'..\'hosta\').to_a` has 3239930 elements on ruby 1.9, adding more \'0\'s and \'a\'s increases that exponentially') # rubocop:disable Metrics/LineLength : unable to cut line to required length + is_expected.to run.with_params('h0', 'ha').and_raise_error(Puppet::ParseError, %r{cannot interpolate between numeric and non-numeric bounds}) } end end