Skip to content

Instantly share code, notes, and snippets.

@wolfspyre
Created July 23, 2014 03:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wolfspyre/61799509f5c0b3874f98 to your computer and use it in GitHub Desktop.
Save wolfspyre/61799509f5c0b3874f98 to your computer and use it in GitHub Desktop.
#!/usr/bin/env rspec
require 'spec_helper'
describe ' mymodule::mydefine', :type => :define do
context 'input validation' do
let (:title) { 'my_title'}
# ['path'].each do |paths|
# context "when the #{paths} parameter is not an absolute path" do
# let (:params) {{ paths => 'foo' }}
# it 'should fail' do
# expect { subject }.to raise_error(Puppet::Error, /"foo" is not an absolute path/)
# end
# end
# end#absolute path
# ['array'].each do |arrays|
# context "when the #{arrays} parameter is not an array" do
# let (:params) {{ arrays => 'this is a string'}}
# it 'should fail' do
# expect { subject }.to raise_error(Puppet::Error, /is not an Array./)
# end
# end
# end#arrays
# ['bool'].each do |bools|
# context "when the #{bools} parameter is not an boolean" do
# let (:params) {{bools => "BOGON"}}
# it 'should fail' do
# expect { subject }.to raise_error(Puppet::Error, /"BOGON" is not a boolean. It looks to be a String/)
# end
# end
# end#bools
# ['hash'].each do |hashes|
# context "when the #{hashes} parameter is not an hash" do
# let (:params) {{ hashes => 'this is a string'}}
# it 'should fail' do
# expect { subject }.to raise_error(Puppet::Error, /is not a Hash./)
# end
# end
# end#hashes
# ['string'].each do |strings|
# context "when the #{strings} parameter is not a string" do
# let (:params) {{strings => false }}
# it 'should fail' do
# expect { subject }.to raise_error(Puppet::Error, /false is not a string./)
# end
# end
# end#strings
end#input validation
['Debian','RedHat'].each do |osfam|
context "When on an #{osfam} system" do
let (:facts) {{'osfamily' => osfam}}
context 'when fed no parameters' do
let (:title) { 'my_title'}
it 'provide a generated catalog for testbuilding' do
p subject.resources
end
end#no params
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment