source: other-projects/hathitrust/vagrant-solr-cluster/trunk/modules/stdlib/spec/functions/is_bool_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.5 KB
Line 
1require 'spec_helper'
2
3describe 'is_bool' do
4
5 it { is_expected.not_to eq(nil) }
6 it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) }
7 it { is_expected.to run.with_params(true, false).and_raise_error(Puppet::ParseError, /wrong number of arguments/i) }
8 it { is_expected.to run.with_params(true).and_return(true) }
9 it { is_expected.to run.with_params(false).and_return(true) }
10 it { is_expected.to run.with_params([1]).and_return(false) }
11 it { is_expected.to run.with_params([{}]).and_return(false) }
12 it { is_expected.to run.with_params([[]]).and_return(false) }
13 it { is_expected.to run.with_params([true]).and_return(false) }
14 it { is_expected.to run.with_params('true').and_return(false) }
15 it { is_expected.to run.with_params('false').and_return(false) }
16 context 'Checking for deprecation warning' do
17 after(:all) do
18 ENV.delete('STDLIB_LOG_DEPRECATIONS')
19 end
20 # Checking for deprecation warning, which should only be provoked when the env variable for it is set.
21 it 'should display a single deprecation' do
22 ENV['STDLIB_LOG_DEPRECATIONS'] = "true"
23 scope.expects(:warning).with(includes('This method is deprecated'))
24 is_expected.to run.with_params(true).and_return(true)
25 end
26 it 'should display no warning for deprecation' do
27 ENV['STDLIB_LOG_DEPRECATIONS'] = "false"
28 scope.expects(:warning).with(includes('This method is deprecated')).never
29 is_expected.to run.with_params(false).and_return(true)
30 end
31 end
32end
33
Note: See TracBrowser for help on using the repository browser.