source: other-projects/hathitrust/vagrant-solr-cluster/trunk/modules/stdlib/spec/aliases/float_spec.rb@ 30960

Last change on this file since 30960 was 30960, checked in by davidb, 7 years ago

Switch to using Puppet to provision machine. Strongly based on files developed for spark-hdfs cluster

File size: 842 bytes
Line 
1require 'spec_helper'
2
3if Puppet.version.to_f >= 4.5
4 describe 'test::float', type: :class do
5 describe 'accepts floats' do
6 [
7 3.7,
8 '3.7',
9 -3.7,
10 '-342.2315e-12',
11 ].each do |value|
12 describe value.inspect do
13 let(:params) {{ value: value }}
14 it { is_expected.to compile }
15 end
16 end
17 end
18
19 describe 'rejects other values' do
20 [ true, 'true', false, 'false', 'iAmAString', '1test', '1 test', 'test 1', 'test 1 test', {}, { 'key' => 'value' }, { 1=> 2 }, '', :undef , 'x', 3, '3', -3, '-3'].each do |value|
21 describe value.inspect do
22 let(:params) {{ value: value }}
23 it { is_expected.to compile.and_raise_error(/parameter 'value' expects a value of type Float or Pattern(\[.*\]+)?/) }
24 end
25 end
26 end
27 end
28end
Note: See TracBrowser for help on using the repository browser.