Skip to content
Browse files

Add rspec puppet tests and puppet module config, based on puppet-maven

  • Loading branch information...
1 parent 56c8858 commit 82eeaa28754cd77c2da46c872409f45b1b609db9 @carlossg carlossg committed Apr 5, 2012
View
8 Gemfile
@@ -0,0 +1,8 @@
+source :rubygems
+
+gem 'puppet', '2.7.12'
+gem 'facter', '1.6.5'
+gem 'rspec-puppet', '0.1.2'
+gem 'rake', '0.9.2.2'
+gem 'puppet-lint', '0.1.12'
+gem 'puppet-module','0.3.4'
View
31 Gemfile.lock
@@ -0,0 +1,31 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ diff-lcs (1.1.3)
+ facter (1.6.5)
+ puppet (2.7.12)
+ facter (>= 1.5.1)
+ puppet-lint (0.1.12)
+ puppet-module (0.3.4)
+ rake (0.9.2.2)
+ rspec (2.9.0)
+ rspec-core (~> 2.9.0)
+ rspec-expectations (~> 2.9.0)
+ rspec-mocks (~> 2.9.0)
+ rspec-core (2.9.0)
+ rspec-expectations (2.9.0)
+ diff-lcs (~> 1.1.3)
+ rspec-mocks (2.9.0)
+ rspec-puppet (0.1.2)
+ rspec
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ facter (= 1.6.5)
+ puppet (= 2.7.12)
+ puppet-lint (= 0.1.12)
+ puppet-module (= 0.3.4)
+ rake (= 0.9.2.2)
+ rspec-puppet (= 0.1.2)
View
10 Modulefile
@@ -0,0 +1,10 @@
+name 'maestrodev-activemq'
+version '0.0.1'
+
+author 'maestrodev'
+license 'Apache License, Version 2.0'
+project_page 'http://github.com/maestrodev/puppet-activemq'
+source 'http://github.com/maestrodev/puppet-activemq'
+summary 'Apache ActiveMQ module for Puppet'
+description 'A Puppet module to install ActiveMQ'
+dependency 'maestrodev/wget', '~0.0.1'
View
20 Rakefile
@@ -0,0 +1,20 @@
+require 'rake/clean'
+require 'puppet-lint/tasks/puppet-lint'
+require 'rspec/core/rake_task'
+
+CLEAN.include('pkg')
+
+PuppetLint.configuration.send("disable_80chars")
+
+desc "Run module RSpec tests."
+RSpec::Core::RakeTask.new(:spec) do |t|
+ t.rspec_opts = ["--format", "doc", "--color"]
+ t.pattern = 'spec/*/*_spec.rb'
+end
+
+desc "Create a Puppet module."
+task :build => [:clean, :lint, :spec] do
+ sh 'puppet-module build'
+end
+
+task :default => :build
View
11 spec/classes/activemq_spec.rb
@@ -0,0 +1,11 @@
+require "#{File.join(File.dirname(__FILE__),'..','spec_helper')}"
+
+describe 'activemq' do
+ let(:title) { 'maven' }
+ let(:params) { { :user => 'myuser' } }
+
+ context "when using default parameters" do
+ it { should contain_service('activemq').with_ensure('running') }
+ end
+
+end
View
3 spec/fixtures/manifests/site.pp
@@ -0,0 +1,3 @@
+node default {
+ notify { 'test': }
+}
View
1 spec/fixtures/modules/activemq/files
View
1 spec/fixtures/modules/activemq/manifests
View
1 spec/fixtures/modules/activemq/templates
View
2 spec/fixtures/modules/wget/manifests/authfetch.pp
@@ -0,0 +1,2 @@
+define wget::authfetch($source,$destination,$user,$password="",$timeout="0") {
+}
View
2 spec/fixtures/modules/wget/manifests/fetch.pp
@@ -0,0 +1,2 @@
+define wget::fetch($source,$destination,$timeout="0") {
+}
View
2 spec/fixtures/modules/wget/manifests/init.pp
@@ -0,0 +1,2 @@
+class wget {
+}
View
8 spec/spec_helper.rb
@@ -0,0 +1,8 @@
+require 'rspec-puppet'
+
+fixture_path = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures'))
+
+RSpec.configure do |c|
+ c.module_path = File.join(fixture_path, 'modules')
+ c.manifest_dir = File.join(fixture_path, 'manifests')
+end

0 comments on commit 82eeaa2

Please sign in to comment.
Something went wrong with that request. Please try again.