Reputation: 10366
I have a user bogus_user
that belongs to three groups bogus_user, sftpusers and airflow
.
In my spec I have the following declaration but I have to put the groups in a particular order for it to pass validation. I dont think this ideal, is there a way to have it check the list of groups and not care about the order?
describe user('bogus_user') do
it { should exist }
its('uid') { should eq 1002 }
its('groups') { should include [ 'bogus_user', 'sftpusers', 'airflow' ] }
its('home') { should eq '/var/ftp/pub/bogus_user' }
end
Upvotes: 0
Views: 611
Reputation: 1525
It is not the nicest nor ideal solution, but it works:
describe user('bogus_user') do
it { should exist }
its('uid') { should eq 1002 }
%w(bogus_user sftpusers airflow).each do |group|
its('groups') { should include group }
end
its('home') { should eq '/var/ftp/pub/bogus_user' }
end
Upvotes: 2