Proof of concept
This commit is contained in:
parent
3bbb83dc27
commit
bcc7ffc6d2
|
@ -0,0 +1 @@
|
|||
*.gem
|
|
@ -0,0 +1,2 @@
|
|||
require 'puppet'
|
||||
require 'puppet-rspec/matchers/exec'
|
|
@ -0,0 +1,34 @@
|
|||
module PuppetRSpec
|
||||
module Matchers
|
||||
extend RSpec::Matchers::DSL
|
||||
|
||||
matcher :create_exec do |expected_title|
|
||||
match do |catalogue|
|
||||
ret = true
|
||||
resources = catalogue.resources.select { |r|
|
||||
r.title == expected_title if r.respond_to? :title
|
||||
}
|
||||
|
||||
unless resources.length == 1
|
||||
ret = false
|
||||
end
|
||||
|
||||
unless @expected_command.nil?
|
||||
unless resources.first.send(:parameters)[:command] == @expected_command
|
||||
ret = false
|
||||
end
|
||||
end
|
||||
ret
|
||||
end
|
||||
description do
|
||||
"create Exec['#{expected_title}']"
|
||||
end
|
||||
failure_message_for_should do |actual|
|
||||
"expected that the catalogue would contain Exec['#{expected_title}']"
|
||||
end
|
||||
chain :with_command do |expected_command|
|
||||
@expected_command = expected_command
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,18 @@
|
|||
Gem::Specification.new do |s|
|
||||
s.name = 'puppet-rspec'
|
||||
s.version = '0.0.1'
|
||||
s.homepage = 'https://github.com/rodjek/puppet-rspec/'
|
||||
s.summary = ''
|
||||
s.description = ''
|
||||
|
||||
s.files = [
|
||||
'puppet-rspec.gemspec',
|
||||
'lib/puppet-rspec.rb',
|
||||
'lib/puppet-rspec/matchers/exec.rb'
|
||||
]
|
||||
|
||||
s.add_dependency 'rspec'
|
||||
|
||||
s.authors = ['Tim Sharpe']
|
||||
s.email = 'tim@sharpe.id.au'
|
||||
end
|
Loading…
Reference in New Issue