Created
June 21, 2013 19:33
-
-
Save maxlinc/5833720 to your computer and use it in GitHub Desktop.
Record facts for any host, reuse within rspec-puppet
This file contains hidden or 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
require 'spec_helper' | |
hosts = Dir['fixtures/facts/*.yaml'].map{|f| File.basename(f, '.yaml')} | |
hosts.each do |host| | |
describe host, :type => :host do | |
let (:facts) { | |
load_fact_fixtures host | |
} | |
# Rspec-puppet has not released the compile matchet yet - you'll need a Gem from master | |
it { should compile.with_all_deps } | |
end | |
end |
This file contains hidden or 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
def load_fact_fixtures(hostname) | |
YAML.load File.read("fixtures/facts/#{hostname}.yaml") | |
end |
This file contains hidden or 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
... | |
config.vm.provision :shell, :inline => "facter --yaml > /vagrant/fixtures/facts/$HOSTNAME.yaml" | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment