如何为以下食谱编写厨师规范
How to write chef spec for following cookbook
这是我的recipe.rb
require 'mixlib/shellout'
require "pry"
find = Mixlib::ShellOut.new("echo hostname -I")
find.run_command.stdout
我应该在规范中写什么?
您不需要 echo 命令来获取输出。您可以直接通过 mixlib/shellout
运行 命令,然后从 stdout
.
获取命令输出
require 'mixlib/shellout'
find = Mixlib::ShellOut.new("hostname -I")
find.run_command.stdout
这是我的recipe.rb
require 'mixlib/shellout'
require "pry"
find = Mixlib::ShellOut.new("echo hostname -I")
find.run_command.stdout
我应该在规范中写什么?
您不需要 echo 命令来获取输出。您可以直接通过 mixlib/shellout
运行 命令,然后从 stdout
.
require 'mixlib/shellout'
find = Mixlib::ShellOut.new("hostname -I")
find.run_command.stdout