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

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