user7208575
user7208575

Reputation:

How to write chef spec for following cookbook?

This is my recipe.rb:

require 'mixlib/shellout'
require "pry"

find = Mixlib::ShellOut.new("echo hostname -I")
find.run_command.stdout

What should I write it in my spec?

Upvotes: 0

Views: 148

Answers (1)

Chandan
Chandan

Reputation: 11807

You don't need the echo command to get the output. you can directly run the command through mixlib/shellout and get then get the command output from stdout.

require 'mixlib/shellout'

find = Mixlib::ShellOut.new("hostname -I")
find.run_command.stdout

Upvotes: 0

Related Questions