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

Last change on this file since 30960 was 30960, checked in by davidb, 8 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 'getparam' do
4 it { is_expected.not_to eq(nil) }
5 it { is_expected.to run.with_params().and_raise_error(ArgumentError, /Must specify a reference/) }
6 it { is_expected.to run.with_params('User[one]').and_raise_error(ArgumentError, /Must specify name of a parameter/) }
7 it { is_expected.to run.with_params('User[one]', 2).and_raise_error(ArgumentError, /Must specify name of a parameter/) }
8 it { is_expected.to run.with_params('User[one]', []).and_raise_error(ArgumentError, /Must specify name of a parameter/) }
9 it { is_expected.to run.with_params('User[one]', {}).and_raise_error(ArgumentError, /Must specify name of a parameter/) }
10
11 describe 'when compared against a user resource with no params' do
12 let(:pre_condition) { 'user { "one": }' }
13
14 it { is_expected.to run.with_params('User[one]', 'ensure').and_return('') }
15 it { is_expected.to run.with_params('User[two]', 'ensure').and_return('') }
16 it { is_expected.to run.with_params('User[one]', 'shell').and_return('') }
17 end
18
19 describe 'when compared against a user resource with params' do
20 let(:pre_condition) { 'user { "one": ensure => present, shell => "/bin/sh", managehome => false, }' }
21
22 it { is_expected.to run.with_params('User[one]', 'ensure').and_return('present') }
23 it { is_expected.to run.with_params('User[two]', 'ensure').and_return('') }
24 it { is_expected.to run.with_params('User[one]', 'shell').and_return('/bin/sh') }
25 it { is_expected.to run.with_params('User[one]', 'managehome').and_return(false) }
26 end
27end
Note: See TracBrowser for help on using the repository browser.