source: other-projects/hathitrust/vagrant-solr-cluster/trunk/modules/stdlib/spec/functions/is_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

  • Property svn:executable set to *
File size: 1.7 KB
Line 
1require 'spec_helper'
2
3describe 'is_float' do
4
5 it { is_expected.not_to eq(nil) }
6
7 it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) }
8 it { is_expected.to run.with_params(0.1, 0.2).and_raise_error(Puppet::ParseError, /wrong number of arguments/i) }
9
10 describe 'passing a string' do
11 it { is_expected.to run.with_params('0.1').and_return(true) }
12 it { is_expected.to run.with_params('1.0').and_return(true) }
13 it { is_expected.to run.with_params('1').and_return(false) }
14 it { is_expected.to run.with_params('one').and_return(false) }
15 it { is_expected.to run.with_params('one 1.0').and_return(false) }
16 it { is_expected.to run.with_params('1.0 one').and_return(false) }
17 end
18
19 describe 'passing numbers' do
20 it { is_expected.to run.with_params(0.1).and_return(true) }
21 it { is_expected.to run.with_params(1.0).and_return(true) }
22 it { is_expected.to run.with_params(1).and_return(false) }
23 end
24
25 context 'Checking for deprecation warning' do
26 after(:all) do
27 ENV.delete('STDLIB_LOG_DEPRECATIONS')
28 end
29 # Checking for deprecation warning, which should only be provoked when the env variable for it is set.
30 it 'should display a single deprecation' do
31 ENV['STDLIB_LOG_DEPRECATIONS'] = "true"
32 scope.expects(:warning).with(includes('This method is deprecated'))
33 is_expected.to run.with_params(2.2).and_return(true)
34 end
35 it 'should display no warning for deprecation' do
36 ENV['STDLIB_LOG_DEPRECATIONS'] = "false"
37 scope.expects(:warning).with(includes('This method is deprecated')).never
38 is_expected.to run.with_params(1.0).and_return(true)
39 end
40 end
41
42end
Note: See TracBrowser for help on using the repository browser.