features/step_definitions/filesystem_steps.rb in berkshelf-0.4.0.rc1 vs features/step_definitions/filesystem_steps.rb in berkshelf-0.4.0.rc2
- old
+ new
@@ -30,11 +30,10 @@
Given /^the cookbook store contains a cookbook "(.*?)" "(.*?)" with dependencies:$/ do |name, version, dependencies|
generate_cookbook(cookbook_store, name, version, dependencies: dependencies.raw)
end
-
Then /^the cookbook store should have the cookbooks:$/ do |cookbooks|
cookbooks.raw.each do |name, version|
cookbook_store.should have_structure {
directory "#{name}-#{version}" do
file "metadata.rb" do
@@ -63,11 +62,131 @@
directory "#{name}-#{version}"
}
end
end
+Then /^I should have the cookbook "(.*?)"$/ do |name|
+ Pathname.new(current_dir).join(name).should be_cookbook
+end
+
+Then /^I should have a new cookbook skeleton "(.*?)"$/ do |name|
+ cb_path = Pathname.new(current_dir).join(name)
+ cb_path.should have_structure {
+ directory "attributes"
+ directory "definitions"
+ directory "files" do
+ directory "default"
+ end
+ directory "libraries"
+ directory "providers"
+ directory "recipes" do
+ file "default.rb"
+ end
+ directory "resources"
+ directory "templates" do
+ directory "default"
+ end
+ file "README.md"
+ file "metadata.rb"
+ file "Berksfile" do
+ contains "metadata"
+ end
+ file "chefignore"
+ file "Berksfile"
+ file "Gemfile" do
+ contains "gem 'berkshelf'"
+ end
+ }
+end
+
+Then /^I should have a new cookbook skeleton "(.*?)" with Vagrant support$/ do |name|
+ steps %Q{ Then I should have a new cookbook skeleton "#{name}" }
+
+ cb_path = Pathname.new(current_dir).join(name)
+ cb_path.should have_structure {
+ file "Gemfile" do
+ contains "gem 'vagrant'"
+ end
+ file "Vagrantfile" do
+ contains "recipe[#{name}::default]"
+ end
+ directory "cookbooks" do
+ directory name
+ end
+ }
+end
+
+Then /^I should have a new cookbook skeleton "(.*?)" with Git support$/ do |name|
+ steps %Q{ Then I should have a new cookbook skeleton "#{name}" }
+
+ cb_path = Pathname.new(current_dir).join(name)
+ cb_path.should have_structure {
+ file ".gitignore"
+ }
+end
+
+Then /^I should have a new cookbook skeleton "(.*?)" with Foodcritic support$/ do |name|
+ steps %Q{ Then I should have a new cookbook skeleton "#{name}" }
+
+ cb_path = Pathname.new(current_dir).join(name)
+ cb_path.should have_structure {
+ file "Gemfile" do
+ contains "gem 'thor-foodcritic'"
+ end
+ file "Thorfile" do
+ contains "require 'thor/foodcritic'"
+ end
+ }
+end
+
+Then /^I should have a new cookbook skeleton "(.*?)" with SCMVersion support$/ do |name|
+ steps %Q{ Then I should have a new cookbook skeleton "#{name}" }
+
+ cb_path = Pathname.new(current_dir).join(name)
+ cb_path.should have_structure {
+ file "Gemfile" do
+ contains "gem 'thor-scmversion'"
+ end
+ file "Thorfile" do
+ contains "require 'thor/scmversion'"
+ end
+ }
+end
+
+Then /^I should have a new cookbook skeleton "(.*?)" without Bundler support$/ do |name|
+ cb_path = Pathname.new(current_dir).join(name)
+ cb_path.should have_structure {
+ directory "attributes"
+ directory "definitions"
+ directory "files" do
+ directory "default"
+ end
+ directory "libraries"
+ directory "providers"
+ directory "recipes" do
+ file "default.rb"
+ end
+ directory "resources"
+ directory "templates" do
+ directory "default"
+ end
+ file "README.md"
+ file "metadata.rb"
+ file "Berksfile" do
+ contains "metadata"
+ end
+ file "chefignore"
+ file "Berksfile"
+ no_file "Gemfile"
+ }
+end
+
Then /^the cookbook "(.*?)" should have the following files:$/ do |name, files|
check_file_presence(files.raw.map{|file_row| File.join(name, file_row[0])}, true)
+end
+
+Then /^the cookbook "(.*?)" should not have the following files:$/ do |name, files|
+ check_file_presence(files.raw.map{|file_row| File.join(name, file_row[0])}, false)
end
Then /^the file "(.*?)" in the cookbook "(.*?)" should contain:$/ do |file_name, cookbook_name, content|
Pathname.new(current_dir).join(cookbook_name).should have_structure {
file "Berksfile" do