4 it { is_expected.not_to eq(nil) }
5 it { is_expected.to run.with_params.and_raise_error(ArgumentError, %r{Must specify a reference}) }
6 it { is_expected.to run.with_params('User[one]').and_raise_error(ArgumentError, %r{Must specify name of a parameter}) }
7 it { is_expected.to run.with_params('User[one]', 2).and_raise_error(ArgumentError, %r{Must specify name of a parameter}) }
8 it { is_expected.to run.with_params('User[one]', []).and_raise_error(ArgumentError, %r{Must specify name of a parameter}) }
9 it { is_expected.to run.with_params('User[one]', {}).and_raise_error(ArgumentError, %r{Must specify name of a parameter}) }
11 describe 'when compared against a user resource with no params' do
12 let(:pre_condition) { 'user { "one": }' }
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('') }
19 describe 'when compared against a user resource with params' do
20 let(:pre_condition) { 'user { "one": ensure => present, shell => "/bin/sh", managehome => false, }' }
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) }
28 describe 'when compared against a user resource with UTF8 and double byte params' do
29 let(:pre_condition) { 'user { ["三", "ƒốưř"]: ensure => present }' }
31 it { is_expected.to run.with_params('User[三]', 'ensure').and_return('present') }
32 it { is_expected.to run.with_params('User[ƒốưř]', 'ensure').and_return('present') }