Creating a Project with Cucumber-Chef

Having gained the approval of your colleagues, you now want to set up a Cucumber project for the purpose of writing your tests and making them pass. A Cucumber project is simply a directory layout containing your features, step definitions, and support code. You’re going want to keep your project under version control, and, given that we’re going to be managing the project on an ongoing basis using Cucumber-Chef, the best place for it is your Chef repository. Remember also that Cucumber-Chef uses your knife.rb, so if you’ve followed the recommendations of this book, you’ll have that in your Chef repository anyway, and Cucumber-Chef will find the right file, and thus the right settings.

Cucumber-Chef has a task which sets up a project for you, so simply run:

$ cd chef-repo
$ cucumber-chef project teamserver
      create  teamserver/README
      create  teamserver/features/example.feature
      create  teamserver/features/step_definitions/example_step.rb
      create  teamserver/features/support/env.rb

This will create a teamserver project under a Cucumber-Chef directory inside your current directory. The example feature and example steps can be deleted—you have all the guidance you’ll need here in this book! You’re already familiar with features. Create a file in the features directory that contains the feature you wrote above.

Now, make sure you’re in the directory which contains the features directory, and run Cucumber. Cucumber will parse your feature, but be unable to find ...

Get Test-Driven Infrastructure with Chef now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.