X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Fstdlib%2Fspec%2Ffunctions%2Fconvert_base_spec.rb;h=d1a6cef14a9f86a75c5fae526b8a63b1010bad8f;hb=131e09855e065be940e104d9ab0f18940cc76257;hp=8ab228454d0e23e3ad31d1e1d3ceddffc527046b;hpb=407d322498f4fde815abf381007fbecfe5c10b2b;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/stdlib/spec/functions/convert_base_spec.rb b/3rdparty/modules/stdlib/spec/functions/convert_base_spec.rb index 8ab228454..d1a6cef14 100644 --- a/3rdparty/modules/stdlib/spec/functions/convert_base_spec.rb +++ b/3rdparty/modules/stdlib/spec/functions/convert_base_spec.rb @@ -2,23 +2,23 @@ require 'spec_helper' describe 'convert_base' do it { is_expected.not_to eq(nil) } - it { is_expected.to run.with_params().and_raise_error(ArgumentError) } - it { is_expected.to run.with_params("asdf").and_raise_error(ArgumentError) } - it { is_expected.to run.with_params("asdf","moo","cow").and_raise_error(ArgumentError) } - it { is_expected.to run.with_params(["1"],"2").and_raise_error(Puppet::ParseError, /argument must be either a string or an integer/) } - it { is_expected.to run.with_params("1",["2"]).and_raise_error(Puppet::ParseError, /argument must be either a string or an integer/) } - it { is_expected.to run.with_params("1",1).and_raise_error(Puppet::ParseError, /base must be at least 2 and must not be greater than 36/) } - it { is_expected.to run.with_params("1",37).and_raise_error(Puppet::ParseError, /base must be at least 2 and must not be greater than 36/) } + it { is_expected.to run.with_params.and_raise_error(ArgumentError) } + it { is_expected.to run.with_params('asdf').and_raise_error(ArgumentError) } + it { is_expected.to run.with_params('asdf', 'moo', 'cow').and_raise_error(ArgumentError) } + it { is_expected.to run.with_params(['1'], '2').and_raise_error(Puppet::ParseError, %r{argument must be either a string or an integer}) } + it { is_expected.to run.with_params('1', ['2']).and_raise_error(Puppet::ParseError, %r{argument must be either a string or an integer}) } + it { is_expected.to run.with_params('1', 1).and_raise_error(Puppet::ParseError, %r{base must be at least 2 and must not be greater than 36}) } + it { is_expected.to run.with_params('1', 37).and_raise_error(Puppet::ParseError, %r{base must be at least 2 and must not be greater than 36}) } - it "should raise a ParseError if argument 1 is a string that does not correspond to an integer in base 10" do - is_expected.to run.with_params("ten",6).and_raise_error(Puppet::ParseError, /argument must be an integer or a string corresponding to an integer in base 10/) + it 'raises a ParseError if argument 1 is a string that does not correspond to an integer in base 10' do + is_expected.to run.with_params('ten', 6).and_raise_error(Puppet::ParseError, %r{argument must be an integer or a string corresponding to an integer in base 10}) end - it "should raise a ParseError if argument 2 is a string and does not correspond to an integer in base 10" do - is_expected.to run.with_params(100,"hex").and_raise_error(Puppet::ParseError, /argument must be an integer or a string corresponding to an integer in base 10/) + it 'raises a ParseError if argument 2 is a string and does not correspond to an integer in base 10' do + is_expected.to run.with_params(100, 'hex').and_raise_error(Puppet::ParseError, %r{argument must be an integer or a string corresponding to an integer in base 10}) end - it { is_expected.to run.with_params("11",'16').and_return('b') } - it { is_expected.to run.with_params("35",'36').and_return('z') } + it { is_expected.to run.with_params('11', '16').and_return('b') } + it { is_expected.to run.with_params('35', '36').and_return('z') } it { is_expected.to run.with_params(5, 2).and_return('101') } end