rspec-puppet 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/rspec-puppet.rb CHANGED
@@ -4,4 +4,7 @@ require 'rspec-puppet/example'
4
4
 
5
5
  RSpec.configure do |c|
6
6
  c.add_setting :module_path, :default => '/etc/puppet/modules'
7
+ c.add_setting :manifest_dir, :default => nil
8
+ c.add_setting :manifest, :default => nil
9
+ c.add_setting :template_dir, :default => nil
7
10
  end
@@ -9,6 +9,9 @@ module RSpec::Puppet
9
9
 
10
10
  def catalogue
11
11
  Puppet[:modulepath] = self.respond_to?(:module_path) ? module_path : RSpec.configuration.module_path
12
+ Puppet[:manifestdir] = self.respond_to?(:manifest_dir) ? manifest_dir : RSpec.configuration.manifest_dir
13
+ Puppet[:manifest] = self.respond_to?(:manifest) ? manifest : RSpec.configuration.manifest
14
+ Puppet[:templatedir] = self.respond_to?(:template_dir) ? template_dir : RSpec.configuration.template_dir
12
15
 
13
16
  klass_name = self.class.top_level_description.downcase
14
17
 
@@ -17,6 +20,8 @@ module RSpec::Puppet
17
20
  if File.exists?(File.join(Puppet[:modulepath], 'manifests', 'init.pp'))
18
21
  path_to_manifest = File.join([Puppet[:modulepath], 'manifests', klass_name.split('::')[1..-1]].flatten)
19
22
  import_str = "import '#{Puppet[:modulepath]}/manifests/init.pp'\nimport '#{path_to_manifest}.pp'\n"
23
+ elsif File.exists?(Puppet[:modulepath])
24
+ import_str = "import '#{Puppet[:manifest]}'\n"
20
25
  else
21
26
  import_str = ""
22
27
  end
@@ -39,6 +44,7 @@ module RSpec::Puppet
39
44
  facts_val = {
40
45
  'hostname' => nodename.split('.').first,
41
46
  'fqdn' => nodename,
47
+ 'domain' => nodename.split('.').last,
42
48
  }
43
49
  facts_val.merge!(munge_facts(facts)) if self.respond_to?(:facts)
44
50
 
@@ -11,12 +11,17 @@ module RSpec::Puppet
11
11
  define_name = self.class.top_level_description.downcase
12
12
 
13
13
  Puppet[:modulepath] = self.respond_to?(:module_path) ? module_path : RSpec.configuration.module_path
14
+ Puppet[:manifestdir] = self.respond_to?(:manifest_dir) ? manifest_dir : RSpec.configuration.manifest_dir
15
+ Puppet[:manifest] = self.respond_to?(:manifest) ? manifest : RSpec.configuration.manifest
16
+ Puppet[:templatedir] = self.respond_to?(:template_dir) ? template_dir : RSpec.configuration.template_dir
14
17
 
15
18
  # If we're testing a standalone module (i.e. one that's outside of a
16
19
  # puppet tree), the autoloader won't work, so we need to fudge it a bit.
17
20
  if File.exists?(File.join(Puppet[:modulepath], 'manifests', 'init.pp'))
18
21
  path_to_manifest = File.join([Puppet[:modulepath], 'manifests', define_name.split('::')[1..-1]].flatten)
19
22
  import_str = "import '#{Puppet[:modulepath]}/manifests/init.pp'\nimport '#{path_to_manifest}.pp'\n"
23
+ elsif File.exists?(Puppet[:modulepath])
24
+ import_str = "import '#{Puppet[:manifest]}'\n"
20
25
  else
21
26
  import_str = ""
22
27
  end
@@ -41,6 +46,7 @@ module RSpec::Puppet
41
46
  facts_val = {
42
47
  'hostname' => nodename.split('.').first,
43
48
  'fqdn' => nodename,
49
+ 'domain' => nodename.split('.', 2).last,
44
50
  }
45
51
  facts_val.merge!(munge_facts(facts)) if self.respond_to?(:facts)
46
52
 
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.8'
3
+ s.version = '0.0.9'
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'
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: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 8
10
- version: 0.0.8
9
+ - 9
10
+ version: 0.0.9
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-08-29 00:00:00 Z
18
+ date: 2011-09-16 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rspec