require 'aruba/api' World(Aruba::Api) World(Berkshelf::RSpec::FileSystemMatchers) Then /^I trace$/ do end When /^I sleep$/ do sleep 10 end Then /^a file named "(.*?)" should exist in the current directory$/ do |filename| in_current_dir do File.exists?(filename).should be_true # not sure why Aruba's # #check_file_presence # doesn't work here. It # looks in the wrong # directory. end end Then /^the file "(.*?)" should contain in the current directory:$/ do |filename, string| in_current_dir do File.read(filename).should match(Regexp.new(string)) end end When /^I run the init command with the cookbook "(.*?)" as the target$/ do |cookbook_name| run_simple(unescape("berks init #{cookbook_name}"), true) end When /^I run the init command with the directory "(.*?)" as the target$/ do |directory_name| run_simple(unescape("berks init #{directory_name}"), true) end When /^I run the init command with no value for the target$/ do run_simple(unescape("berks init"), true) end When /^I run the install command$/ do run_simple(unescape("berks install"), false) end When /^I run the install command with flags:$/ do |flags| run_simple(unescape("berks install #{flags.raw.join(" ")}"), false) end When /^I run the update command$/ do run_simple(unescape("berks update"), true) end When /^I run the upload command$/ do run_simple(unescape("berks upload"), true) end When /^I run the cookbook command to create "(.*?)"$/ do |name| run_simple(unescape("berks cookbook #{name}")) end When /^I run the cookbook command to create "(.*?)" with options:$/ do |name, options| run_simple(unescape("berks cookbook #{name} #{options.raw.join(" ")}")) end Then /^the CLI should exit with the status code for error "(.*?)"$/ do |error_constant| exit_status = Berkshelf.const_get(error_constant).status_code assert_exit_status(exit_status) end