Skip to content

Instantly share code, notes, and snippets.

@kogent
Forked from wrecked/installed_test.rb
Created January 30, 2009 17:33
Show Gist options
  • Save kogent/55154 to your computer and use it in GitHub Desktop.
Save kogent/55154 to your computer and use it in GitHub Desktop.
# Simple example of using ShadowFacter with RSpec to verify system configuration
# http://twitter.com/bradleyktaylor | http://railsmachine.com
#
# run with 'spec -c installed_test.rb'
require 'shadow_facter'
def installed_fact(n)
name = n
fact(name) { exec("#{name.to_s} --version") ? true : false }
end
namespace :installed do
installed_fact :rails
installed_fact :git
installed_fact :mysql
installed_fact :puppet
installed_fact :rake
end
describe "My system" do
before :each do
@installed = facts(:installed)
end
it "has ruby on rails installed and available" do
@installed[:rails].should equal(true)
end
it "has mysql installed and available" do
@installed[:mysql].should equal(true)
end
it "has git installed and available" do
@installed[:git].should equal(true)
end
it "has puppet installed and available" do
@installed[:puppet].should equal(true)
end
it "has rake installed and available" do
@installed[:rake].should equal(true)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment