source: other-projects/hathitrust/vagrant-solr-cluster/trunk/modules/stdlib/spec/functions/validate_hash_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.8 KB
Line 
1require 'spec_helper'
2
3describe 'validate_hash' do
4 describe 'signature validation' do
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
8 describe 'check for deprecation warning' do
9 after(:all) do
10 ENV.delete('STDLIB_LOG_DEPRECATIONS')
11 end
12 # Checking for deprecation warning
13 it 'should display a single deprecation' do
14 ENV['STDLIB_LOG_DEPRECATIONS'] = "true"
15 scope.expects(:warning).with(includes('This method is deprecated'))
16 is_expected.to run.with_params({'key' => 'value'})
17 end
18 end
19
20 describe 'valid inputs' do
21 it { is_expected.to run.with_params({}) }
22 it { is_expected.to run.with_params({'key' => 'value'}) }
23 it { is_expected.to run.with_params({}, {'key' => 'value'}) }
24 it { is_expected.to run.with_params({'key1' => 'value1'}, {'key2' => 'value2'}) }
25 end
26
27 describe 'invalid inputs' do
28 it { is_expected.to run.with_params([]).and_raise_error(Puppet::ParseError, /is not a Hash/) }
29 it { is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError, /is not a Hash/) }
30 it { is_expected.to run.with_params(true).and_raise_error(Puppet::ParseError, /is not a Hash/) }
31 it { is_expected.to run.with_params('one').and_raise_error(Puppet::ParseError, /is not a Hash/) }
32 it { is_expected.to run.with_params({}, []).and_raise_error(Puppet::ParseError, /is not a Hash/) }
33 it { is_expected.to run.with_params({}, 1).and_raise_error(Puppet::ParseError, /is not a Hash/) }
34 it { is_expected.to run.with_params({}, true).and_raise_error(Puppet::ParseError, /is not a Hash/) }
35 it { is_expected.to run.with_params({}, 'one').and_raise_error(Puppet::ParseError, /is not a Hash/) }
36 end
37 end
38end
Note: See TracBrowser for help on using the repository browser.