Module: RSpec::Puppet::TypeExampleGroup

Includes:
Support, TypeMatchers
Defined in:
lib/rspec-puppet/example/type_example_group.rb

Instance Attribute Summary

Attributes included from Support

#adapter

Instance Method Summary collapse

Methods included from Support

#build_catalog, #build_catalog_without_cache, #build_code, #class_name, #environment, #escape_special_chars, #facts_hash, #find_pretend_platform, #guess_type_from_path, #import_str, #load_catalogue, #munge_facts, #node_params_hash, #nodename, #param_str, #param_str_from_hash, #post_cond, #pre_cond, #ref, #rspec_compatibility, #sanitise_resource_title, #server_facts_hash, #setup_puppet, #site_pp_str, #str_from_value, #stub_facts!, #stub_file_consts, #test_manifest, #trusted_facts_hash, #with_vardir

Methods included from GenericMatchers

#raise_error

Methods included from TypeMatchers

#method_missing

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RSpec::Puppet::TypeMatchers

Instance Method Details

#rspec_puppet_cleanupObject



22
23
24
# File 'lib/rspec-puppet/example/type_example_group.rb', line 22

def rspec_puppet_cleanup
  @type_and_resource = nil
end

#subjectObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rspec-puppet/example/type_example_group.rb', line 6

def subject
  @type_and_resource ||= begin
    setup_puppet
    type_name = self.class.top_level_description.downcase
    my_params = self.respond_to?(:params) ? params : {}
    [
      Puppet::Type.type(type_name),
      # I don't want to create the resource here, so I have
      # to pass all of the bits form the current scope
      # required to create it
      title,
      my_params
    ]
  end
end