Method: PDK::Generate::PuppetClass#target_spec_path

Defined in:
lib/pdk/generate/puppet_class.rb

#target_spec_pathString

Calculates the path to the file where the tests for the new class will be written.

written.

Returns:

  • (String)

    the path where the tests for the new class will be



36
37
38
39
40
41
42
43
44
45
# File 'lib/pdk/generate/puppet_class.rb', line 36

def target_spec_path
  @target_spec_path ||= begin
    class_name_parts = object_name.split('::')

    # drop the module name if the object name contains multiple parts
    class_name_parts.delete_at(0) if class_name_parts.length > 1

    "#{File.join(module_dir, 'spec', 'classes', *class_name_parts)}_spec.rb"
  end
end