Skip to content

Instantly share code, notes, and snippets.

@auxesis
Created February 4, 2011 08:34
Show Gist options
  • Select an option

  • Save auxesis/810878 to your computer and use it in GitHub Desktop.

Select an option

Save auxesis/810878 to your computer and use it in GitHub Desktop.
When /^I build the gem$/ do
project_root = Pathname.new(File.dirname(__FILE__)).parent.parent.expand_path
rakefile = project_root.join('Rakefile')
File.exist?(rakefile).should be_true
puts `rake -f #{rakefile} build`
end
When /^I install the latest gem$/ do
project_root = Pathname.new(File.dirname(__FILE__)).parent.parent.expand_path
pkg_dir = project_root.join('pkg')
glob = File.join(pkg_dir, '*.gem')
latest = Dir.glob(glob).sort {|a, b| File.ctime(a) <=> File.ctime(b) }.last
silent_system("gem install --local #{latest}").should be_true
end
Then /^I should have cucumber\-nagios\-gen on my path$/ do
silent_system("which cucumber-nagios-gen").should be_true
end
Then /^I can generate a new project$/ do
testproj = "testproj-#{Time.now.to_i}"
FileUtils.rm_rf("/tmp/#{testproj}")
silent_system("cd /tmp ; cucumber-nagios-gen project #{testproj}").should be_true
File.exists?("/tmp/#{testproj}").should be_true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment