1 | require 'spec_helper'
|
---|
2 |
|
---|
3 | describe '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
|
---|
27 | end
|
---|