Inspec Check Multiple Features


#1

Hi, I want to check if multiple features are installed on a Windows server. I am using windows_feature audit resource but I have multiple roles/feature to check. Checking 1 feature at a time like this is lengthening the code -

describe windows_feature('ADRMS') do
it {should be_installed}
end

Instead what I want is that I put all the roles in an array and go through each of them using audit resource to ensure that the features are installed. How can I do that?

I tried something like this and It didnt work-
roles = ['ADRMS','Hyper-V','Fax']
describe windows_feature(roles) do
it {should be_installed}
end


#2

NVM, for anyone who has got the same problem, here's the logic-
roles = ['ADRMS','Hyper-V','Fax']
for i in roles
describe windows_feature("roles#{i}") do
it { should_not be_installed }
end
end