Closed jtimberman closed 9 years ago
It kind of looks like it might fit into the lib/minitest-chef-handler/resources.rb file? Probably then needs to be expanded in the assertions.rb and infections.rb, but it's almost certain I'm way off :)
Yeah, I think it would fit well into the resource. Your implementation has a bug on windows though, in the line 13 you're using / to concat path and command, you should use File.join that uses the specific file separator.
It may be worth using @erikh's which gem for this:
It's a pretty small gem. If you find the code suitable no need to add a dependency, just bring it in. :)
It doesn't handle PATHEXT properly on windows, but shouldn't be much work to fix that.
In testing behavior of cookbooks, it is desirable to check to see if a specific command is available in the default $PATH. For example, the
zsh
cookbook by Opscode simply installs zsh, and the best post-convergence test is whetherzsh
is available to run. We have this "which" method (via stackoverflow):https://github.com/opscode-cookbooks/zsh/blob/master/files/default/tests/minitest/support/helpers.rb#L7-18
I'm happy to add this and send a pull request, but I don't know where it best fits.