2017-09-06 13 views
0

私はシェフには比較的新しく、ChefSpecには新しくありません。私はどのようにわからないChefSpecの適用プラットフォームとバージョンについてのシェフ警告

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 

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を実行すると、私は出力にこれを取得:私は以下のspec_helper.rbファイルを使用してChefSpecカバレッジを取得するためにCoverageを実行しようとしていますCoverageにプラットフォームとバージョンを指定してください - ChefSpec::ServerRunner.new()で行う方法の例を見ました。

答えて

1

私は具体的に言うことはできませんので、あなたの仕様を表示しませんが、エラーが示すように、platformversionオプションをランナーコンストラクターに渡す必要があります。たとえば、ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04')です。スペックヘルパーのすべてのテストで一度グローバルに指定することもできます。指示はChefSpec READMEにあります。

関連する問題