我对 Chef 比较陌生,对 ChefSpec 也很陌生。我正在尝试Coverage
使用以下文件运行以获取 ChefSpec 覆盖范围spec_helper.rb
:
require 'chefspec'
require 'chefspec/berkshelf'
ChefSpec::Coverage.start! do
add_output do |reportOutput|
File.open( "coverage.json","w" ) do |f|
f.puts(reportOutput[:total])
f.puts(reportOutput[:touched])
f.puts(reportOutput[:coverage])
f.puts(reportOutput[:untouched_resources])
f.puts(reportOutput[:all_resources])
end
end
end
当我运行时rspec
,我在输出中得到这个:
WARNING: you must specify a 'platform' and 'version' to your ChefSpec
Runner and/or Fauxhai constructor, in the future omitting these will
become a hard error. A list of available platforms is available at
https://github.com/chefspec/fauxhai/blob/master/PLATFORMS.md
.WARNING: you must specify a 'platform' and 'version' to your ChefSpec
Runner and/or Fauxhai constructor, in the future omitting these will
become a hard error. A list of available platforms is available at
https://github.com/chefspec/fauxhai/blob/master/PLATFORMS.md
我不确定如何在中指定平台和版本Coverage
- 我看到了一些关于如何使用ChefSpec::ServerRunner.new()
.