rspec-puppet 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -31,7 +31,11 @@ module RSpec::Puppet
|
|
31
31
|
Puppet[:code] = import_str + define_name + " { \"" + title + "\": " + param_str + " }"
|
32
32
|
|
33
33
|
nodename = self.respond_to?(:node) ? node : Puppet[:certname]
|
34
|
-
facts_val =
|
34
|
+
facts_val = {
|
35
|
+
'hostname' => nodename.split('.').first,
|
36
|
+
'fqdn' => nodename,
|
37
|
+
}
|
38
|
+
facts_val.merge!(facts) if self.respond_to?(:facts)
|
35
39
|
|
36
40
|
node_obj = Puppet::Node.new(nodename)
|
37
41
|
|
@@ -2,7 +2,7 @@ module RSpec::Puppet
|
|
2
2
|
module Matchers
|
3
3
|
class CreateGeneric
|
4
4
|
def initialize(*args, &block)
|
5
|
-
@exp_resource_type = args.shift.to_s.gsub(/^
|
5
|
+
@exp_resource_type = args.shift.to_s.gsub(/^(create|contain)_/, '')
|
6
6
|
@args = args
|
7
7
|
@block = block
|
8
8
|
@referenced_type = referenced_type(@exp_resource_type)
|
@@ -58,7 +58,7 @@ module RSpec::Puppet
|
|
58
58
|
private
|
59
59
|
|
60
60
|
def referenced_type(type)
|
61
|
-
type.split('
|
61
|
+
type.split('__').map { |r| r.capitalize }.join('::')
|
62
62
|
end
|
63
63
|
|
64
64
|
def errors
|
@@ -67,7 +67,7 @@ module RSpec::Puppet
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def method_missing(method, *args, &block)
|
70
|
-
return RSpec::Puppet::Matchers::CreateGeneric.new(method, *args, &block) if method.to_s =~ /^
|
70
|
+
return RSpec::Puppet::Matchers::CreateGeneric.new(method, *args, &block) if method.to_s =~ /^(create|contain)_/
|
71
71
|
super
|
72
72
|
end
|
73
73
|
end
|
data/rspec-puppet.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'rspec-puppet'
|
3
|
-
s.version = '0.0.
|
3
|
+
s.version = '0.0.3'
|
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'
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe 'sysctl::common' do
|
4
|
-
it { should
|
4
|
+
it { should contain_exec('sysctl/reload') \
|
5
5
|
.with_command('/sbin/sysctl -p /etc/sysctl.conf').with_returns([0, 2]) }
|
6
6
|
it { should_not create_augeas('foo') }
|
7
7
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-puppet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tim Sharpe
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-07-
|
18
|
+
date: 2011-07-21 00:00:00 +10:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|