lib/cucumber/chef/steps/chef_steps.rb in cucumber-chef-2.1.0.rc.4 vs lib/cucumber/chef/steps/chef_steps.rb in cucumber-chef-2.1.0.rc.5

- old
+ new

@@ -21,15 +21,24 @@ And /^the following (databag|databags) (has|have) been (updated|uploaded):$/ do |ignore0, ignore1, ignore2, table| table.hashes.each do |entry| data_bag = entry['databag'] data_bag_path = entry['databag_path'] + $test_lab.knife_cli(%Q{data bag create "#{data_bag}"}, :silence => true) + $test_lab.knife_cli(%Q{data bag from file "#{data_bag}" "#{data_bag_path}"}, :silence => true) + end +end - $test_lab.knife_cli(%Q{data bag from file #{data_bag} #{data_bag_path}}, :silence => true) +And /^the following (databag|databags) (has|have) been (deleted|removed):$/ do |ignore0, ignore1, ignore2, table| + table.hashes.each do |entry| + data_bag = entry['databag'] + $test_lab.knife_cli(%Q{data bag delete "#{data_bag}" --yes}, :silence => true) end end +################################################################################ + And /^the following (role|roles) (has|have) been (updated|uploaded):$/ do |ignore0, ignore1, ignore2, table| table.hashes.each do |entry| role = entry['role'] role_path = entry['role_path'] @@ -41,10 +50,12 @@ $test_lab.knife_cli(%Q{role from file #{File.join(role_path, role)}}, :silence => true) end end end +################################################################################ + And /^the following (cookbook|cookbooks) (has|have) been (updated|uploaded):$/ do |ignore0, ignore1, ignore2, table| cookbooks = table.hashes.inject(Hash.new) do |memo, entry| cookbook = entry['cookbook'] cookbook_path = entry['cookbook_path'] @@ -54,10 +65,16 @@ cookbooks.each do |cookbook_path, cookbooks| $test_lab.knife_cli(%Q{cookbook upload #{cookbooks.join(" ")} -o #{cookbook_path}}, :silence => true) end end +And /^all of the cookbooks in "([^\"]*)" (has|have) been (updated|uploaded)$/ do |cookbook_path, ignore0, ignore1| + $test_lab.knife_cli(%Q{cookbook upload -a -o #{cookbook_path}}, :silence => true) +end + +################################################################################ + And /^the following (environment|environments) (has|have) been (updated|uploaded):$/ do |ignore0, ignore1, ignore2, table| table.hashes.each do |entry| environment = entry['environment'] environment_path = entry['environment_path'] @@ -68,5 +85,7 @@ else $test_lab.knife_cli(%Q{environment from file #{File.join(environment_path, environment)}}, :silence => true) end end end + +################################################################################