Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Request: Can we include unit testing skeletons with recipe generators? #152

Closed
brandocorp opened this issue Sep 8, 2014 · 4 comments
Closed

Comments

@brandocorp
Copy link
Contributor

I was thinking it might be useful to add the generation of unit test files for their associated cookbook files. If a person was to generate a recipe named 'foo', they would get the recipe file along with its associated spec file like so:

Compiling Cookbooks...
Recipe: code_generator::recipe
  * template[/opt/working/chef/cookbooks/foobar/recipes/foobar.rb] action create
    - create new file /opt/working/chef/cookbooks/foobar/recipes/foobar.rb
    - update content in file /opt/working/chef/cookbooks/foobar/recipes/foobar.rb from none to e3b0c4
    (diff output suppressed by config)
 * template[/opt/working/chef/cookbooks/foobar/spec/recipes/foobar_spec.rb] action create
    - create new file /opt/working/chef/cookbooks/foobar/spec/recipes/foobar.rb
    - update content in file /opt/working/chef/cookbooks/foobar/spec/recipes/foobar.rb from none to e3b0c4
    (diff output suppressed by config)

This would include modifying the chef generate cookbook command to add the spec/recipes folder and a default_spec.rb.

@jreslock
Copy link

jreslock commented Sep 8, 2014

+1 to @brandocorp's idea. Having just a basic unit test is helpful,
especially for n00b rubyists/chefs.

On Mon, Sep 8, 2014 at 2:24 PM, brandocorp notifications@github.com wrote:

I was thinking it might be useful to add the generation of unit test files
for their associated cookbook files. If a person was to generate a recipe
named 'foo', they would get the recipe file along with its associated spec
file like so:

Compiling Cookbooks...
Recipe: code_generator::recipe

  • template[/opt/working/chef/cookbooks/foobar/recipes/foobar.rb] action create
    • create new file /opt/working/chef/cookbooks/foobar/recipes/foobar.rb
    • update content in file /opt/working/chef/cookbooks/foobar/recipes/foobar.rb from none to e3b0c4
      (diff output suppressed by config)
    • template[/opt/working/chef/cookbooks/foobar/spec/recipes/foobar_spec.rb] action create
- create new file /opt/working/chef/cookbooks/foobar/spec/recipes/foobar.rb
- update content in file /opt/working/chef/cookbooks/foobar/spec/recipes/foobar.rb from none to e3b0c4
(diff output suppressed by config)

This would include modifying the chef generate cookbook command to add
the spec/recipes folder and a default_spec.rb.


Reply to this email directly or view it on GitHub
#152.

@sethvargo
Copy link

Knife-spec is good example to go off of

@brandocorp
Copy link
Contributor Author

I have opened #153 for this issue

@nathenharvey
Copy link
Contributor

This was released in version 0.3.6 as part of #266

ksubrama pushed a commit that referenced this issue Jan 11, 2016
Refactor msi building logic into omnibus-ruby as a packager
@chef-boneyard chef-boneyard locked and limited conversation to collaborators Feb 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

4 participants