我正在测试一个资源,我想检查它的参数数量是否正确,但其中一个是 a require
,我还没有弄清楚如何在 a 中匹配with
。我使用 . 测试关系是否正确that_requires
。我目前的测试看起来像
context 'xldeploy_environment_member' do
env = "Environments/#{company_short}/#{environment_short}/#{sn_environment}"
name = "#{env}/#{website}"
dict = "#{env}/dict.#{website}"
infhost = "Infrastructure/IIS/#{hostname}"
it { is_expected.to contain_xldeploy_environment_member(name).with({
:id => name,
:ensure => 'present',
:env => name,
:dictionaries => [dict],
:members => ["#{infhost}/#{website}", infhost],
}.merge($xldeploy_defaults))}
it { is_expected.to contain_xldeploy_environment_member(name).that_requires(
"Xldeploy_ci[#{name}]")
}
end
但我想用 替换with
,only_with
因为这with
将允许在没有相应测试的情况下添加额外的参数。如果有一张parameter_count
支票,比如有一张resource_count
支票,我可以使用它。是否rspec-puppet
支持正则表达式匹配,以便我可以检查参数是否存在?我对实际内容不感兴趣,因为这是由that_requires
.