Class: USCoreTestKit::Generator::PractitionerAddressTestGenerator
- Inherits:
-
Object
- Object
- USCoreTestKit::Generator::PractitionerAddressTestGenerator
- Defined in:
- lib/us_core_test_kit/generator/practitioner_address_test_generator.rb
Instance Attribute Summary collapse
-
#base_output_dir ⇒ Object
Returns the value of attribute base_output_dir.
-
#group_metadata ⇒ Object
Returns the value of attribute group_metadata.
Class Method Summary collapse
Instance Method Summary collapse
- #base_output_file_name ⇒ Object
- #class_name ⇒ Object
- #generate ⇒ Object
-
#initialize(group_metadata, base_output_dir) ⇒ PractitionerAddressTestGenerator
constructor
A new instance of PractitionerAddressTestGenerator.
- #module_name ⇒ Object
- #output ⇒ Object
- #output_file_directory ⇒ Object
- #output_file_name ⇒ Object
- #profile_identifier ⇒ Object
- #template ⇒ Object
- #test_id ⇒ Object
Constructor Details
#initialize(group_metadata, base_output_dir) ⇒ PractitionerAddressTestGenerator
Returns a new instance of PractitionerAddressTestGenerator.
14 15 16 17 |
# File 'lib/us_core_test_kit/generator/practitioner_address_test_generator.rb', line 14 def initialize(, base_output_dir) self. = self.base_output_dir = base_output_dir end |
Instance Attribute Details
#base_output_dir ⇒ Object
Returns the value of attribute base_output_dir.
12 13 14 |
# File 'lib/us_core_test_kit/generator/practitioner_address_test_generator.rb', line 12 def base_output_dir @base_output_dir end |
#group_metadata ⇒ Object
Returns the value of attribute group_metadata.
12 13 14 |
# File 'lib/us_core_test_kit/generator/practitioner_address_test_generator.rb', line 12 def @group_metadata end |
Class Method Details
.generate(ig_metadata, base_output_dir) ⇒ Object
5 6 7 8 9 |
# File 'lib/us_core_test_kit/generator/practitioner_address_test_generator.rb', line 5 def generate(, base_output_dir) .groups .reject { |group| SpecialCases.exclude_group? group } .each { |group| new(group, base_output_dir).generate } end |
Instance Method Details
#base_output_file_name ⇒ Object
27 28 29 |
# File 'lib/us_core_test_kit/generator/practitioner_address_test_generator.rb', line 27 def base_output_file_name "#{class_name.underscore}.rb" end |
#class_name ⇒ Object
47 48 49 |
# File 'lib/us_core_test_kit/generator/practitioner_address_test_generator.rb', line 47 def class_name "PractitionerAddressTest" end |
#generate ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/us_core_test_kit/generator/practitioner_address_test_generator.rb', line 55 def generate return unless .resource == 'Practitioner' && .version[1].to_i > 5 FileUtils.mkdir_p(output_file_directory) File.open(output_file_name, 'w') { |f| f.write(output) } .add_test( id: test_id, file_name: base_output_file_name ) end |
#module_name ⇒ Object
51 52 53 |
# File 'lib/us_core_test_kit/generator/practitioner_address_test_generator.rb', line 51 def module_name "USCore#{.reformatted_version.upcase}" end |
#output ⇒ Object
23 24 25 |
# File 'lib/us_core_test_kit/generator/practitioner_address_test_generator.rb', line 23 def output @output ||= ERB.new(template).result(binding) end |
#output_file_directory ⇒ Object
31 32 33 |
# File 'lib/us_core_test_kit/generator/practitioner_address_test_generator.rb', line 31 def output_file_directory File.join(base_output_dir, profile_identifier) end |
#output_file_name ⇒ Object
35 36 37 |
# File 'lib/us_core_test_kit/generator/practitioner_address_test_generator.rb', line 35 def output_file_name File.join(output_file_directory, base_output_file_name) end |
#profile_identifier ⇒ Object
39 40 41 |
# File 'lib/us_core_test_kit/generator/practitioner_address_test_generator.rb', line 39 def profile_identifier Naming.snake_case_for_profile() end |
#template ⇒ Object
19 20 21 |
# File 'lib/us_core_test_kit/generator/practitioner_address_test_generator.rb', line 19 def template @template ||= File.read(File.join(__dir__, 'templates', 'practitioner_address_test.rb.erb')) end |
#test_id ⇒ Object
43 44 45 |
# File 'lib/us_core_test_kit/generator/practitioner_address_test_generator.rb', line 43 def test_id "us_core_#{.reformatted_version}_practitioner_address_test" end |