jnewland (owner)

Fork Of

Revisions

  • 65dadf Wed Jan 28 14:45:11 -0800 2009
gist: 54246 Download_button fork
public
Public Clone URL: git://gist.github.com/54246.git
Embed All Files: show embed
installed_test.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Simple example of using ShadowFacter with RSpec to verify system configuration
# bradley @ 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