Currently I tried to run the below test in my kitchen test but if failed due to command was broken after the “|” piping symbol.
describe command("history | awk '{print $2}' | head -n1") do
its("stdout") { should match /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/ }
end
Is there a way to let the above test command works? I am intended to test the history
command output format contains YYYY-MM-DD date format. Thanks.