source: other-projects/hathitrust/vagrant-hadoop-cluster/trunk/modules/stdlib/spec/aliases/numeric_spec.rb@ 30903

Last change on this file since 30903 was 30903, checked in by davidb, 8 years ago

Vagrant provisioning files for a 4-node Hadoop cluster. See README.txt for more details

File size: 889 bytes
Line 
1require 'spec_helper'
2
3if Puppet.version.to_f >= 4.5
4 describe 'test::numeric', type: :class 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 let(:params) {{ value: value }}
18 it { is_expected.to compile }
19 end
20 end
21 end
22
23 describe 'rejects other values' do
24 [ true, 'true', false, 'false', 'iAmAString', '1test', '1 test', 'test 1', 'test 1 test', {}, { 'key' => 'value' }, { 1=> 2 }, '', :undef , 'x' ].each do |value|
25 describe value.inspect do
26 let(:params) {{ value: value }}
27 it { is_expected.to compile.and_raise_error(/parameter 'value' expects a value of type Numeric, Pattern(\[.*\]+)?, or Array/) }
28 end
29 end
30 end
31 end
32end
Note: See TracBrowser for help on using the repository browser.