rspec-puppet 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ module RSpec::Puppet
2
+ module Support
3
+ def build_catalog nodename, facts_val
4
+ node_obj = Puppet::Node.new(nodename)
5
+
6
+ node_obj.merge(facts_val)
7
+
8
+ # trying to be compatible with 2.7 as well as 2.6
9
+ if Puppet::Resource::Catalog.respond_to? :find
10
+ Puppet::Resource::Catalog.find(node_obj.name, :use_node => node_obj)
11
+ else
12
+ require 'puppet/face'
13
+ Puppet::Face[:catalog, :current].find(node_obj.name, :use_node => node_obj)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'rspec-puppet'
3
- s.version = '0.0.4'
3
+ s.version = '0.0.5'
4
4
  s.homepage = 'https://github.com/rodjek/rspec-puppet/'
5
5
  s.summary = 'RSpec tests for your Puppet manifests'
6
6
  s.description = 'RSpec tests for your Puppet manifests'
@@ -13,13 +13,17 @@ Gem::Specification.new do |s|
13
13
  'lib/rspec-puppet/matchers/create_resource.rb',
14
14
  'lib/rspec-puppet/matchers/include_class.rb',
15
15
  'lib/rspec-puppet/matchers.rb',
16
+ 'lib/rspec-puppet/support.rb',
16
17
  'lib/rspec-puppet.rb',
17
18
  'LICENSE',
18
19
  'Rakefile',
19
20
  'README.md',
20
21
  'rspec-puppet.gemspec',
22
+ 'spec/classes/boolean_spec.rb',
21
23
  'spec/classes/sysctl_common_spec.rb',
24
+ 'spec/defines/sysctl_before_spec.rb',
22
25
  'spec/defines/sysctl_spec.rb',
26
+ 'spec/fixtures/boolean/manifests/init.pp',
23
27
  'spec/fixtures/sysctl/manifests/init.pp',
24
28
  'spec/spec_helper.rb',
25
29
  ]
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'boolean' do
4
+ let(:title) { 'bool.testing' }
5
+ let(:params) { { :bool => false } }
6
+
7
+ it { should create_notify("bool testing")\
8
+ .with_message("This will print when \$bool is false.") }
9
+
10
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'sysctl::before' do
4
+ let(:title) { 'sysctl::before' }
5
+ let(:params) { { :value => "title" } }
6
+
7
+ it "Should raise an error about needing the sysctl::common class" do
8
+ expect { should create_notify("message-title")\
9
+ .with_message("This should print if the class is here first.") }\
10
+ .to raise_error(Puppet::Error, /Could not find resource 'Class\[Sysctl::Common\]/)
11
+ end
12
+ end
13
+
14
+ describe 'sysctl::before' do
15
+ let(:title) { 'test define' }
16
+ let(:pre_condition) { 'class {"sysctl::common":}' }
17
+ let(:params) { { :value => "title" } }
18
+
19
+ it { should create_resource("sysctl::before", 'test define')\
20
+ .with_param(:value, "title") }
21
+
22
+ it { should include_class("sysctl::common") }
23
+
24
+ end
@@ -0,0 +1,12 @@
1
+ class boolean($bool) {
2
+ $real_bool = $bool ? {
3
+ true => false,
4
+ false => true,
5
+ }
6
+
7
+ if ($real_bool) {
8
+ notify {"bool testing":
9
+ message => "This will print when \$bool is false."
10
+ }
11
+ }
12
+ }
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 4
9
- version: 0.0.4
8
+ - 5
9
+ version: 0.0.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Tim Sharpe
@@ -45,13 +45,17 @@ files:
45
45
  - lib/rspec-puppet/matchers/create_resource.rb
46
46
  - lib/rspec-puppet/matchers/include_class.rb
47
47
  - lib/rspec-puppet/matchers.rb
48
+ - lib/rspec-puppet/support.rb
48
49
  - lib/rspec-puppet.rb
49
50
  - LICENSE
50
51
  - Rakefile
51
52
  - README.md
52
53
  - rspec-puppet.gemspec
54
+ - spec/classes/boolean_spec.rb
53
55
  - spec/classes/sysctl_common_spec.rb
56
+ - spec/defines/sysctl_before_spec.rb
54
57
  - spec/defines/sysctl_spec.rb
58
+ - spec/fixtures/boolean/manifests/init.pp
55
59
  - spec/fixtures/sysctl/manifests/init.pp
56
60
  - spec/spec_helper.rb
57
61
  has_rdoc: true