diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/aliases/integer_spec.rb | 4 | ||||
-rw-r--r-- | spec/functions/ensure_resources_spec.rb (renamed from spec/unit/ensure_resources_spec.rb) | 0 | ||||
-rwxr-xr-x | spec/functions/is_integer_spec.rb | 3 | ||||
-rwxr-xr-x | spec/unit/puppet/provider/file_line/ruby_spec.rb | 3 |
4 files changed, 8 insertions, 2 deletions
diff --git a/spec/aliases/integer_spec.rb b/spec/aliases/integer_spec.rb index bd00c2a..8cb4658 100644 --- a/spec/aliases/integer_spec.rb +++ b/spec/aliases/integer_spec.rb @@ -8,6 +8,8 @@ if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0 '3', -3, '-3', + "123\nfoo", + "foo\n123", ].each do |value| describe value.inspect do let(:params) {{ value: value }} @@ -17,7 +19,7 @@ if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0 end describe 'rejects other values' do - [ true, 'true', false, 'false', 'iAmAString', '1test', '1 test', 'test 1', 'test 1 test', {}, { 'key' => 'value' }, { 1=> 2 }, '', :undef , 'x', 3.7, '3.7',-3.7, '-342.2315e-12' ].each do |value| + [ "foo\nbar", true, 'true', false, 'false', 'iAmAString', '1test', '1 test', 'test 1', 'test 1 test', {}, { 'key' => 'value' }, { 1=> 2 }, '', :undef , 'x', 3.7, '3.7',-3.7, '-342.2315e-12' ].each do |value| describe value.inspect do let(:params) {{ value: value }} it { is_expected.to compile.and_raise_error(/parameter 'value' expects a value of type Integer, Pattern(\[.*\]+)?, or Array/) } diff --git a/spec/unit/ensure_resources_spec.rb b/spec/functions/ensure_resources_spec.rb index aea723e..aea723e 100644 --- a/spec/unit/ensure_resources_spec.rb +++ b/spec/functions/ensure_resources_spec.rb diff --git a/spec/functions/is_integer_spec.rb b/spec/functions/is_integer_spec.rb index b296830..8118ef4 100755 --- a/spec/functions/is_integer_spec.rb +++ b/spec/functions/is_integer_spec.rb @@ -11,6 +11,8 @@ describe 'is_integer' do it { is_expected.to run.with_params('3').and_return(true) } it { is_expected.to run.with_params(-3).and_return(true) } it { is_expected.to run.with_params('-3').and_return(true) } + it { is_expected.to run.with_params("123\nfoo").and_return(true) } + it { is_expected.to run.with_params("foo\n123").and_return(true) } it { is_expected.to run.with_params(3.7).and_return(false) } it { is_expected.to run.with_params('3.7').and_return(false) } @@ -24,6 +26,7 @@ describe 'is_integer' do it { is_expected.to run.with_params(true).and_return(false) } it { is_expected.to run.with_params(false).and_return(false) } it { is_expected.to run.with_params('0001234').and_return(false) } + it { is_expected.to run.with_params("foo\nbar").and_return(false) } context 'Checking for deprecation warning' do after(:all) do diff --git a/spec/unit/puppet/provider/file_line/ruby_spec.rb b/spec/unit/puppet/provider/file_line/ruby_spec.rb index 0e12aa2..dcf8509 100755 --- a/spec/unit/puppet/provider/file_line/ruby_spec.rb +++ b/spec/unit/puppet/provider/file_line/ruby_spec.rb @@ -2,7 +2,8 @@ require 'spec_helper' require 'tempfile' provider_class = Puppet::Type.type(:file_line).provider(:ruby) -describe provider_class do +# These tests fail on windows when run as part of the rake task. Individually they pass +describe provider_class, :unless => Puppet::Util::Platform.windows? do context "when adding" do let :tmpfile do tmp = Tempfile.new('tmp') |