Introducing knife-spec


Ohai Chefs!

As mentioned in the release notes for ChefSpec 3.0, the knife subcommand “create_specs” was removed as it was untested and didn’t particularly belong bundled inside ChefSpec. I just open sourced and released knife-spec - a handy knife plugin that replaces the removed create_specs command for ChefSpec.


What’s the new command?
Short answer - there isn’t one.
Long answer - having knife-spec installed in your bundle/gemset will hook into the default knife cookbook create command and add an action routine for creating the specs.

Why a different plugin?
I felt that the plugin should be versioned and managed separately from ChefSpec. I don’t think an RSpec expert should need to know the inner workings of knife subcommands, and I don’t think that a knife expert needs to know all the inner workings of RSpec. Separating them into two gems makes it much easier for the community to get involved without being an expert on a topic.

Does it require ChefSpec 3?
Yes and no. The default scaffolding generates a skeleton with mostly commented code. Many of those features only work on ChefSpec 3.

How it it tested?
Why, I’m glad you asked! There are two levels of testing: unit and integration. The unit tests are plain-old-rspec and are very similar to those tests in Chef itself. However, the awesome-sauce is in the aruba tests. I’ve setup the aruba tests to actually run "knife cookbook create” against different Chef versions and then inspect the filesystem and file contents. I’d love to see other knife plugins try this pattern and let me know what you think!

Happy cook(book)ing!
Seth Vargo
Solutions Engineer, Opscode