-
-
Save kogent/55154 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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