puppet-retrospec 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +5 -6
  3. data/LICENSE +661 -20
  4. data/README.md +93 -45
  5. data/VERSION +1 -1
  6. data/bin/retrospec +6 -2
  7. data/lib/{puppet-retrospec.rb → retrospec.rb} +13 -50
  8. data/lib/retrospec/conditional.rb +53 -0
  9. data/lib/{helpers.rb → retrospec/helpers.rb} +4 -0
  10. data/lib/retrospec/resource.rb +37 -0
  11. data/lib/{templates → retrospec/templates}/acceptance_spec_test.erb +0 -0
  12. data/lib/{templates → retrospec/templates}/fixtures_file.erb +1 -1
  13. data/lib/{templates → retrospec/templates}/gemfile.erb +1 -1
  14. data/lib/{templates → retrospec/templates}/nodesets/centos-59-x64.yml +0 -0
  15. data/lib/{templates → retrospec/templates}/nodesets/centos-64-x64-pe.yml +0 -0
  16. data/lib/{templates → retrospec/templates}/nodesets/centos-64-x64.yml +0 -0
  17. data/lib/{templates → retrospec/templates}/nodesets/centos-65-x64.yml +0 -0
  18. data/lib/{templates → retrospec/templates}/nodesets/debian-607-x64.yml +0 -0
  19. data/lib/{templates → retrospec/templates}/nodesets/debian-70rc1-x64.yml +0 -0
  20. data/lib/{templates → retrospec/templates}/nodesets/debian-73-i386.yml +0 -0
  21. data/lib/{templates → retrospec/templates}/nodesets/debian-73-x64.yml +0 -0
  22. data/lib/{templates → retrospec/templates}/nodesets/default.yml +0 -0
  23. data/lib/{templates → retrospec/templates}/nodesets/fedora-18-x64.yml +0 -0
  24. data/lib/{templates → retrospec/templates}/nodesets/sles-11sp1-x64.yml +0 -0
  25. data/lib/{templates → retrospec/templates}/nodesets/ubuntu-server-10044-x64.yml +0 -0
  26. data/lib/{templates → retrospec/templates}/nodesets/ubuntu-server-12042-x64.yml +0 -0
  27. data/lib/{templates → retrospec/templates}/nodesets/ubuntu-server-1310-x64.yml +0 -0
  28. data/lib/{templates → retrospec/templates}/nodesets/ubuntu-server-1404-x64.yml +0 -0
  29. data/lib/{templates → retrospec/templates}/rakefile.erb +0 -0
  30. data/lib/retrospec/templates/resource_spec_file.erb +45 -0
  31. data/lib/{templates → retrospec/templates}/shared_context.erb +3 -1
  32. data/lib/{templates → retrospec/templates}/spec_helper_acceptance.rb.erb +0 -0
  33. data/lib/{templates → retrospec/templates}/spec_helper_file.erb +0 -0
  34. data/lib/retrospec/type_code.rb +18 -0
  35. data/lib/retrospec/variable_store.rb +82 -0
  36. data/lib/retrospec/version.rb +3 -0
  37. data/puppet-retrospec.gemspec +54 -33
  38. data/spec/fixtures/fixture_modules/one_resource_module/manifests/another_resource_class.pp +28 -0
  39. data/spec/fixtures/fixture_modules/one_resource_module/manifests/one_resource_class.pp +6 -0
  40. data/spec/fixtures/fixture_modules/zero_resource_module/manifests/empty_class.pp +3 -0
  41. data/spec/spec_helper.rb +2 -1
  42. data/spec/unit/conditional_spec.rb +43 -0
  43. data/spec/unit/puppet-retrospec_spec.rb +4 -41
  44. data/spec/unit/resource_spec.rb +62 -0
  45. data/spec/unit/type_code_spec.rb +39 -0
  46. data/spec/unit/variable_store_spec.rb +82 -0
  47. metadata +107 -53
  48. data/lib/templates/resource_spec_file.erb +0 -40
File without changes
@@ -0,0 +1,45 @@
1
+ require 'spec_helper'
2
+ require 'shared_contexts'
3
+
4
+ describe '<%= @type.name -%>' do
5
+ # by default the hiera integration uses hirea data from the shared_contexts.rb file
6
+ # but basically to mock hiera you first need to add a key/value pair
7
+ # to the specific context in the spec/shared_contexts.rb file
8
+ # Note: you can only use a single hiera context per describe/context block
9
+ # rspec-puppet does not allow you to swap out hiera data on a per test block
10
+ #include_context :hiera
11
+
12
+ <%- if @type.type == :definition -%>
13
+ let(:title) { 'example_name' }
14
+ <%- end -%>
15
+
16
+ # below is the facts hash that gives you the ability to mock
17
+ # facts on a per describe/context block. If you use a fact in your
18
+ # manifest you should mock the facts below.
19
+ let(:facts) do
20
+ {}
21
+ end
22
+ # below is a list of the resource parameters that you can override.
23
+ # By default all non-required parameters are commented out,
24
+ # while all required parameters will require you to add a value
25
+ let(:params) do
26
+ {
27
+ <%- @parameters.each do |k,v| -%>
28
+ <%- if v.nil? -%>
29
+ <%= ":#{k} => 'place_value_here'," %>
30
+ <%- else -%>
31
+ <%= "#:#{k} => #{v}," %>
32
+ <%- end -%>
33
+ <%- end -%>
34
+ }
35
+ end
36
+ # add these two lines in a single test block to enable puppet and hiera debug mode
37
+ # Puppet::Util::Log.level = :debug
38
+ # Puppet::Util::Log.newdestination(:console)
39
+ <%- @resources.each do |res| -%>
40
+ it do
41
+ should contain_<%= res.type.gsub('::', '__')%>('<%= res.title %>').
42
+ with(<%= res.parameters.to_s.gsub(/\",/, "\",\n ") %>)
43
+ end
44
+ <%- end -%>
45
+ end
@@ -1,6 +1,8 @@
1
1
  require 'hiera-puppet-helper'
2
2
 
3
- # optional, this should be the path to where the hirea data config file is in this repo
3
+ # optional, this should be the path to where the hiera data config file is in this repo
4
+ # You must update this if your actual hiera data lives inside your module.
5
+ # I only assume its data, but it could be anything
4
6
  hiera_config_file = File.expand_path(File.join(File.dirname(__FILE__), '..','data', 'hiera.yaml'))
5
7
 
6
8
  # hiera_file and hiera_data are mutally exclusive contexts.
@@ -0,0 +1,18 @@
1
+ class TypeCode
2
+ attr_reader :type, :variables, :scope_name
3
+
4
+ #TODO figure out how to store vardef statements that are contained inside conditional blocks
5
+ def initialize(type)
6
+ @scope_name = type.name
7
+ @type = type
8
+ end
9
+
10
+ def variables
11
+ if @type.code.respond_to?(:find_all)
12
+ @variables ||= @type.code.find_all {|i| i.instance_of?(Puppet::Parser::AST::VarDef) }
13
+ else
14
+ @variables = []
15
+ end
16
+ @variables
17
+ end
18
+ end
@@ -0,0 +1,82 @@
1
+ require 'singleton'
2
+ require 'retrospec/type_code'
3
+
4
+ class VariableStore
5
+ attr_reader :store
6
+
7
+ include Singleton
8
+
9
+ def initialize
10
+ @store = {}
11
+ end
12
+
13
+ def self.instance
14
+ @@instance ||= new
15
+ end
16
+
17
+ # key should be a variable starting with $
18
+ # enable_value_conversion converts the value to a string
19
+ def self.add(key, value, enable_value_conversion=true)
20
+ key = "$#{key.to_s}" unless key.to_s.start_with?('$')
21
+ if value.instance_of?(String) or value.instance_of?(Puppet::Parser::AST::String)
22
+ value = value.to_s.gsub("\"",'')
23
+ end
24
+ if enable_value_conversion
25
+ instance.store[key.to_s] = value.to_s
26
+ else
27
+ instance.store[key.to_s] = value
28
+ end
29
+ end
30
+
31
+ # lookup the key in the hash, if we dont' find it lets just return the string representation
32
+ def self.lookup(key)
33
+ key = "$#{key.to_s}" unless key.to_s.start_with?('$')
34
+ begin
35
+ value = VariableStore.instance.store.fetch(key.to_s)
36
+ # try and resolve if necessary
37
+ if [Puppet::Parser::AST::Variable,Puppet::Parser::AST::VarDef].include?(value.class)
38
+ value = resolve(value)
39
+ end
40
+ rescue
41
+ return key
42
+ end
43
+ value
44
+ end
45
+
46
+ def self.variable_resolution(variable)
47
+ res = nil
48
+ if variable.instance_of? Puppet::Parser::AST::VarDef
49
+ res = lookup(variable.name.value)
50
+ add(variable.name, variable.value,false) unless res.nil?
51
+ elsif variable.instance_of?(Puppet::Parser::AST::Variable)
52
+ res = lookup(variable.value)
53
+ elsif variable.instance_of?(Puppet::Parser::AST::Concat)
54
+ begin
55
+ res = variable.value.map { |i| variable_resolution(i)}.join.gsub("\"",'')
56
+ rescue
57
+ res = variable.value
58
+ end
59
+ else
60
+ # I give up, I can't find the variable value so will just assign the variable name
61
+ res = variable.to_s
62
+ end
63
+ if not res.nil?
64
+ if variable.instance_of?(Puppet::Parser::AST::Variable)
65
+ if not VariableStore.instance.store.keys.include?(variable.to_s)
66
+ add(variable, res)
67
+ end
68
+ end
69
+ end
70
+ res
71
+ end
72
+
73
+ # will try and resolve the variable to a value by consulting the variables hash
74
+ def self.resolve(variable)
75
+ res = variable_resolution(variable)
76
+ end
77
+
78
+ # gets all the variables and passes them through the resolve function to populate the variable store
79
+ def self.populate(type)
80
+ TypeCode.new(type).variables.each {|v| add(v.name, resolve(v.value))}
81
+ end
82
+ end
@@ -0,0 +1,3 @@
1
+ module Puppet_Retrospec
2
+ VERSION = "0.5.0"
3
+ end
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: puppet-retrospec 0.4.0 ruby lib
5
+ # stub: puppet-retrospec 0.5.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "puppet-retrospec"
9
- s.version = "0.4.0"
9
+ s.version = "0.5.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Corey Osman"]
14
- s.date = "2014-11-21"
14
+ s.date = "2015-02-09"
15
15
  s.description = "Retrofits and generates valid puppet rspec test code to existing modules"
16
16
  s.email = "corey@logicminds.biz"
17
17
  s.executables = ["retrospec"]
@@ -29,48 +29,60 @@ Gem::Specification.new do |s|
29
29
  "Rakefile",
30
30
  "VERSION",
31
31
  "bin/retrospec",
32
- "lib/helpers.rb",
33
- "lib/puppet-retrospec.rb",
34
- "lib/templates/acceptance_spec_test.erb",
35
- "lib/templates/fixtures_file.erb",
36
- "lib/templates/gemfile.erb",
37
- "lib/templates/nodesets/centos-59-x64.yml",
38
- "lib/templates/nodesets/centos-64-x64-pe.yml",
39
- "lib/templates/nodesets/centos-64-x64.yml",
40
- "lib/templates/nodesets/centos-65-x64.yml",
41
- "lib/templates/nodesets/debian-607-x64.yml",
42
- "lib/templates/nodesets/debian-70rc1-x64.yml",
43
- "lib/templates/nodesets/debian-73-i386.yml",
44
- "lib/templates/nodesets/debian-73-x64.yml",
45
- "lib/templates/nodesets/default.yml",
46
- "lib/templates/nodesets/fedora-18-x64.yml",
47
- "lib/templates/nodesets/sles-11sp1-x64.yml",
48
- "lib/templates/nodesets/ubuntu-server-10044-x64.yml",
49
- "lib/templates/nodesets/ubuntu-server-12042-x64.yml",
50
- "lib/templates/nodesets/ubuntu-server-1310-x64.yml",
51
- "lib/templates/nodesets/ubuntu-server-1404-x64.yml",
52
- "lib/templates/rakefile.erb",
53
- "lib/templates/resource_spec_file.erb",
54
- "lib/templates/shared_context.erb",
55
- "lib/templates/spec_helper_acceptance.rb.erb",
56
- "lib/templates/spec_helper_file.erb",
32
+ "lib/retrospec.rb",
33
+ "lib/retrospec/conditional.rb",
34
+ "lib/retrospec/helpers.rb",
35
+ "lib/retrospec/resource.rb",
36
+ "lib/retrospec/templates/acceptance_spec_test.erb",
37
+ "lib/retrospec/templates/fixtures_file.erb",
38
+ "lib/retrospec/templates/gemfile.erb",
39
+ "lib/retrospec/templates/nodesets/centos-59-x64.yml",
40
+ "lib/retrospec/templates/nodesets/centos-64-x64-pe.yml",
41
+ "lib/retrospec/templates/nodesets/centos-64-x64.yml",
42
+ "lib/retrospec/templates/nodesets/centos-65-x64.yml",
43
+ "lib/retrospec/templates/nodesets/debian-607-x64.yml",
44
+ "lib/retrospec/templates/nodesets/debian-70rc1-x64.yml",
45
+ "lib/retrospec/templates/nodesets/debian-73-i386.yml",
46
+ "lib/retrospec/templates/nodesets/debian-73-x64.yml",
47
+ "lib/retrospec/templates/nodesets/default.yml",
48
+ "lib/retrospec/templates/nodesets/fedora-18-x64.yml",
49
+ "lib/retrospec/templates/nodesets/sles-11sp1-x64.yml",
50
+ "lib/retrospec/templates/nodesets/ubuntu-server-10044-x64.yml",
51
+ "lib/retrospec/templates/nodesets/ubuntu-server-12042-x64.yml",
52
+ "lib/retrospec/templates/nodesets/ubuntu-server-1310-x64.yml",
53
+ "lib/retrospec/templates/nodesets/ubuntu-server-1404-x64.yml",
54
+ "lib/retrospec/templates/rakefile.erb",
55
+ "lib/retrospec/templates/resource_spec_file.erb",
56
+ "lib/retrospec/templates/shared_context.erb",
57
+ "lib/retrospec/templates/spec_helper_acceptance.rb.erb",
58
+ "lib/retrospec/templates/spec_helper_file.erb",
59
+ "lib/retrospec/type_code.rb",
60
+ "lib/retrospec/variable_store.rb",
61
+ "lib/retrospec/version.rb",
57
62
  "puppet-retrospec.gemspec",
63
+ "spec/fixtures/fixture_modules/one_resource_module/manifests/another_resource_class.pp",
64
+ "spec/fixtures/fixture_modules/one_resource_module/manifests/one_resource_class.pp",
65
+ "spec/fixtures/fixture_modules/zero_resource_module/manifests/empty_class.pp",
58
66
  "spec/fixtures/fixture_modules/zero_resource_module/manifests/not_a_resource_defination.pp",
59
67
  "spec/fixtures/manifests/includes-class.pp",
60
68
  "spec/fixtures/manifests/includes-defines.pp",
61
69
  "spec/spec_helper.rb",
62
- "spec/unit/puppet-retrospec_spec.rb"
70
+ "spec/unit/conditional_spec.rb",
71
+ "spec/unit/puppet-retrospec_spec.rb",
72
+ "spec/unit/resource_spec.rb",
73
+ "spec/unit/type_code_spec.rb",
74
+ "spec/unit/variable_store_spec.rb"
63
75
  ]
64
76
  s.homepage = "http://github.com/logicminds/puppet-retrospec"
65
77
  s.licenses = ["MIT"]
66
- s.rubygems_version = "2.4.4"
78
+ s.rubygems_version = "2.4.5"
67
79
  s.summary = "Generates puppet rspec test code based on the classes and defines inside the manifests directory. Aims to reduce some of the boilerplate coding with default test patterns."
68
80
 
69
81
  if s.respond_to? :specification_version then
70
82
  s.specification_version = 4
71
83
 
72
84
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
73
- s.add_runtime_dependency(%q<puppet>, [">= 0"])
85
+ s.add_runtime_dependency(%q<puppet>, ["= 3.7.3"])
74
86
  s.add_runtime_dependency(%q<trollop>, [">= 0"])
75
87
  s.add_development_dependency(%q<rspec>, ["~> 2.14"])
76
88
  s.add_development_dependency(%q<yard>, ["~> 0.7"])
@@ -79,8 +91,11 @@ Gem::Specification.new do |s|
79
91
  s.add_development_dependency(%q<jeweler>, [">= 0"])
80
92
  s.add_development_dependency(%q<pry>, [">= 0"])
81
93
  s.add_development_dependency(%q<fakefs>, [">= 0"])
94
+ s.add_development_dependency(%q<pry-rescue>, [">= 0"])
95
+ s.add_development_dependency(%q<pry-stack_explorer>, [">= 0"])
96
+ s.add_development_dependency(%q<pry-coolline>, [">= 0"])
82
97
  else
83
- s.add_dependency(%q<puppet>, [">= 0"])
98
+ s.add_dependency(%q<puppet>, ["= 3.7.3"])
84
99
  s.add_dependency(%q<trollop>, [">= 0"])
85
100
  s.add_dependency(%q<rspec>, ["~> 2.14"])
86
101
  s.add_dependency(%q<yard>, ["~> 0.7"])
@@ -89,9 +104,12 @@ Gem::Specification.new do |s|
89
104
  s.add_dependency(%q<jeweler>, [">= 0"])
90
105
  s.add_dependency(%q<pry>, [">= 0"])
91
106
  s.add_dependency(%q<fakefs>, [">= 0"])
107
+ s.add_dependency(%q<pry-rescue>, [">= 0"])
108
+ s.add_dependency(%q<pry-stack_explorer>, [">= 0"])
109
+ s.add_dependency(%q<pry-coolline>, [">= 0"])
92
110
  end
93
111
  else
94
- s.add_dependency(%q<puppet>, [">= 0"])
112
+ s.add_dependency(%q<puppet>, ["= 3.7.3"])
95
113
  s.add_dependency(%q<trollop>, [">= 0"])
96
114
  s.add_dependency(%q<rspec>, ["~> 2.14"])
97
115
  s.add_dependency(%q<yard>, ["~> 0.7"])
@@ -100,6 +118,9 @@ Gem::Specification.new do |s|
100
118
  s.add_dependency(%q<jeweler>, [">= 0"])
101
119
  s.add_dependency(%q<pry>, [">= 0"])
102
120
  s.add_dependency(%q<fakefs>, [">= 0"])
121
+ s.add_dependency(%q<pry-rescue>, [">= 0"])
122
+ s.add_dependency(%q<pry-stack_explorer>, [">= 0"])
123
+ s.add_dependency(%q<pry-coolline>, [">= 0"])
103
124
  end
104
125
  end
105
126
 
@@ -0,0 +1,28 @@
1
+ class one_resource::another_resource(
2
+ $var1 = 'value1',
3
+ $var2 = 'value2',
4
+ $file_name = '/tmp/test3',
5
+ $config_base_path = '/etc/hammer'
6
+
7
+ ){
8
+ $some_var = "oohhhh"
9
+ $concat_var = "${file_name}/test3183/${some_var}"
10
+ $cli_modules = "${config_base_path}/cli.modules.d"
11
+
12
+ file{'/tmp/test2':
13
+ ensure => present,
14
+ }
15
+ file{$file_name:
16
+ ensure => present,
17
+ content => $concat_var
18
+ }
19
+ if $file_name {
20
+ $if_var1 = 'if_var1_value1'
21
+ file{"$file_name/3":
22
+ ensure => present,
23
+ }
24
+ }
25
+ else {
26
+ $if_var1 = 'if_var1_value2'
27
+ }
28
+ }
@@ -0,0 +1,6 @@
1
+ class one_resource{
2
+
3
+ file{'/tmp/test':
4
+ ensure => present,
5
+ }
6
+ }
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,7 @@
1
- require 'puppet-retrospec'
1
+ require 'retrospec'
2
2
  require 'rspec'
3
3
  require 'puppet'
4
+ require 'pry'
4
5
 
5
6
  def fixture_modules_path
6
7
  @fixture_module_path ||= File.expand_path(File.join(fixtures_path, 'modules'))
@@ -0,0 +1,43 @@
1
+ require 'spec_helper'
2
+
3
+ describe "conditional" do
4
+ after :all do
5
+ # enabling the removal slows down tests, but from time to time we may need to
6
+ FileUtils.rm_rf(fixture_modules_path) if ENV['RETROSPEC_CLEAN_UP_TEST_MODULES'] =~ /true/
7
+ end
8
+
9
+ before :all do
10
+ # enabling the removal of real modules slows down tests, but from time to time we may need to
11
+ FileUtils.rm_rf(fixture_modules_path) if ENV['RETROSPEC_CLEAN_UP_TEST_MODULES'] =~ /true/
12
+ end
13
+
14
+ before :each do
15
+ my_path = File.expand_path(File.join('spec', 'fixtures', 'fixture_modules', 'one_resource_module'))
16
+ my_retro = Retrospec.new(my_path)
17
+ @test_type = my_retro.types.find {|x| x.name == 'one_resource::another_resource'}
18
+ Resource.all(@test_type)
19
+ conds = Conditional.find_conditionals(@test_type)
20
+ @con = Conditional.new(conds.first, @test_type.arguments)
21
+ end
22
+
23
+ it 'should initialize ' do
24
+ expect(@con.class).to eq(Conditional)
25
+ end
26
+
27
+
28
+ it 'should generate conditional resources' do
29
+ r = Conditional.all(@test_type)
30
+ VariableStore.populate(@test_type)
31
+ expect(r.length).to eq(1)
32
+ expect(r[0].parameters).to eq({"ensure"=>"present"})
33
+ expect(r[0].title).to eq("/tmp/test3/3")
34
+ expect(r[0].type).to eq("file")
35
+ end
36
+
37
+ it 'should respond correctly to empty class' do
38
+ my_path = File.expand_path(File.join('spec', 'fixtures', 'fixture_modules', 'zero_resource_module'))
39
+ my_retro = Retrospec.new(my_path)
40
+ test_type = my_retro.types.find {|x| x.name == 'empty_class'}
41
+ expect{Conditional.all(test_type)}.to_not raise_error
42
+ end
43
+ end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
- require 'puppet-retrospec'
3
- require 'helpers'
2
+ require 'retrospec'
4
3
  require 'fakefs/safe'
4
+ require 'retrospec/helpers'
5
5
 
6
6
  describe "puppet-retrospec" do
7
7
  after :all do
@@ -18,7 +18,7 @@ describe "puppet-retrospec" do
18
18
  end
19
19
 
20
20
  before :each do
21
- clean_up_spec_dir(@path)
21
+ #clean_up_spec_dir(@path)
22
22
  @opts = {:module_path => @path, :enable_beaker_tests => false,
23
23
  :enable_user_templates => false, :template_dir => nil }
24
24
  end
@@ -45,6 +45,7 @@ describe "puppet-retrospec" do
45
45
  end
46
46
 
47
47
  it 'should not create acceptance test files' do
48
+ clean_up_spec_dir(@path)
48
49
  @opts[:enable_beaker_tests] = false
49
50
  tomcat = Retrospec.new(@opts[:module_path], @opts)
50
51
  spec_path = File.expand_path(File.join(@path, 'spec'))
@@ -237,42 +238,4 @@ describe "puppet-retrospec" do
237
238
  expect(tomcat.generate_file_name('tomcat::config')).to eq('config_spec.rb')
238
239
  end
239
240
 
240
- # it 'should contain a list of parameters in the test' do
241
- # tomcat = Retrospec.new(@opts[:module_path], @opts)
242
- # tomcat.create_files
243
- #
244
- # end
245
- #
246
- # it 'should retrieve a list of includes' do
247
- # # ie. {"includes-class"=>["class1", "class2", "class3", "class6"]}
248
- # includes = @retro.included_declarations('spec/fixtures/manifests/includes-class.pp')
249
- # includes['includes-class'].should eq(["class1", "class2", "class3", "class6"])
250
- # end
251
- #
252
- # it 'should not include the require statements' do
253
- # # ie. {"includes-class"=>["class1", "class2", "class3", "class6"]}
254
- # includes = @retro.included_declarations('spec/fixtures/manifests/includes-class.pp')
255
- # includes['includes-class'].should_not eq(["class1", "class2", "class3", "class4", "class5", "class6"])
256
- # end
257
- #
258
- #
259
- # it 'should retrieve a list of define names' do
260
- # # ie. [{:filename=>"includes-class", :types=>[{:type_name=>"class", :name=>"includes-class"}]}]
261
- # my_retro = Retrospec.new('spec/fixtures/manifests/includes-defines.pp')
262
- # classes = my_retro.classes_and_defines('spec/fixtures/manifests/includes-defines.pp')
263
- # types = classes.first[:types]
264
- # types.first[:type_name].should eq('define')
265
- # types.first[:name].should eq("webinstance")
266
- # end
267
- #
268
- #
269
- # it 'included_declarations should not be nil' do
270
- # @retro.included_declarations(@retro.manifest_files.first).length.should >= 1
271
- # end
272
- #
273
- #
274
- # it 'modules_included should not be nil' do
275
- # @retro.modules_included.length.should eq(1)
276
- # end
277
-
278
241
  end