class Retrospec::Puppet::Generators::AcceptanceGenerator

Public Class Methods

generate_spec_files(module_path, config_data) click to toggle source
# File lib/retrospec/plugins/v1/plugin/generators/acceptance_generator.rb, line 37
def self.generate_spec_files(module_path, config_data)
  files = []
  manifest_files(module_path).each do |file|
    acceptance = new(module_path, config_data.merge({:manifest_file => file}))
    next unless supported_types.include?(acceptance.resource_type)
    files << acceptance.generate_spec_file
  end
  files
end
new(module_path, spec_object = {}) click to toggle source

retrospec will initilalize this class so its up to you to set any additional variables you need to get the job done.

# File lib/retrospec/plugins/v1/plugin/generators/acceptance_generator.rb, line 12
def initialize(module_path, spec_object = {})
  super
  @singular_name = 'acceptance'
  @plural_name = 'acceptance'
end
supported_types() click to toggle source
# File lib/retrospec/plugins/v1/plugin/generators/acceptance_generator.rb, line 26
def self.supported_types
  unless @supported_types
    @supported_types =
    [
      ::Puppet::Pops::Model::HostClassDefinition,
      ::Puppet::Pops::Model::ResourceTypeDefinition
    ]
  end
  @supported_types
end

Public Instance Methods

spec_path() click to toggle source
# File lib/retrospec/plugins/v1/plugin/generators/acceptance_generator.rb, line 22
def spec_path
  File.join(module_path, 'spec', plural_name, 'classes')
end
spec_template_file() click to toggle source
# File lib/retrospec/plugins/v1/plugin/generators/acceptance_generator.rb, line 18
def spec_template_file
  File.join('acceptance_spec_test.rb.retrospec.erb')
end