Add missing new files from commit 131e09855e06
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / spec / type_aliases / numeric_spec.rb
1 require 'spec_helper'
2
3 if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
4   describe 'Stdlib::Compat::Numeric' do
5     describe 'accepts numerics' do
6       [
7         3,
8         '3',
9         -3,
10         '-3',
11         3.7,
12         '3.7',
13         -3.7,
14         '-342.2315e-12',
15       ].each do |value|
16         describe value.inspect do
17           it { is_expected.to allow_value(value) }
18         end
19       end
20     end
21
22     describe 'rejects other values' do
23       [true, 'true', false, 'false', 'iAmAString', '1test', '1 test', 'test 1', 'test 1 test', {}, { 'key' => 'value' }, { 1 => 2 }, '', :undef, 'x'].each do |value|
24         describe value.inspect do
25           it { is_expected.not_to allow_value(value) }
26         end
27       end
28     end
29   end
30 end