Sha256: f1db1603b5399625a4215b09a05ad7aa32d6ed716735274221fd9cd8b3382497
Contents?: true
Size: 1.7 KB
Versions: 2
Compression:
Stored size: 1.7 KB
Contents
require_relative 'naming' require_relative 'special_cases' module USCoreTestKit class Generator class ReferenceResolutionTestGenerator class << self def generate(ig_metadata) ig_metadata.groups .reject { |group| SpecialCases.exclude_resource? group.resource } .each { |group| new(group).generate } end end attr_accessor :group_metadata def initialize(group_metadata) self.group_metadata = group_metadata end def template @template ||= File.read(File.join(__dir__, 'templates', 'reference_resolution.rb.erb')) end def output @output ||= ERB.new(template).result(binding) end def base_output_file_name "#{class_name.underscore}.rb" end def output_file_directory File.join(__dir__, '..', 'generated', profile_identifier) end def output_file_name File.join(output_file_directory, base_output_file_name) end def profile_identifier Naming.snake_case_for_profile(group_metadata) end def test_id "us_core_311_#{profile_identifier}_reference_resolution_test" end def class_name "#{Naming.upper_camel_case_for_profile(group_metadata)}ReferenceResolutionTest" end def resource_type group_metadata.resource end def resource_collection_string 'scratch_resources[:all]' end def generate FileUtils.mkdir_p(output_file_directory) File.open(output_file_name, 'w') { |f| f.write(output) } group_metadata.add_test( id: test_id, file_name: base_output_file_name ) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
us_core_test_kit-0.1.1 | lib/us_core_test_kit/generator/reference_resolution_test_generator.rb |
us_core_test_kit-0.1.0 | lib/us_core_test_kit/generator/reference_resolution_test_generator.rb |