ipa_test_kit 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (270) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +201 -0
  3. data/lib/ipa_test_kit/custom_groups/capability_statement/conformance_support_test.rb +41 -0
  4. data/lib/ipa_test_kit/custom_groups/capability_statement/fhir_version_test.rb +15 -0
  5. data/lib/ipa_test_kit/custom_groups/capability_statement/json_support_test.rb +39 -0
  6. data/lib/ipa_test_kit/custom_groups/capability_statement/profile_support_test.rb +76 -0
  7. data/lib/ipa_test_kit/custom_groups/capability_statement_group.rb +64 -0
  8. data/lib/ipa_test_kit/date_search_validation.rb +101 -0
  9. data/lib/ipa_test_kit/ext/fhir_models.rb +59 -0
  10. data/lib/ipa_test_kit/fhir_resource_navigation.rb +63 -0
  11. data/lib/ipa_test_kit/generated/allergy_intolerance/allergy_intolerance_must_support_test.rb +40 -0
  12. data/lib/ipa_test_kit/generated/allergy_intolerance/allergy_intolerance_patient_clinical_status_search_test.rb +46 -0
  13. data/lib/ipa_test_kit/generated/allergy_intolerance/allergy_intolerance_patient_search_test.rb +60 -0
  14. data/lib/ipa_test_kit/generated/allergy_intolerance/allergy_intolerance_provenance_revinclude_search_test.rb +49 -0
  15. data/lib/ipa_test_kit/generated/allergy_intolerance/allergy_intolerance_read_test.rb +24 -0
  16. data/lib/ipa_test_kit/generated/allergy_intolerance/allergy_intolerance_reference_resolution_test.rb +28 -0
  17. data/lib/ipa_test_kit/generated/allergy_intolerance/allergy_intolerance_validation_test.rb +34 -0
  18. data/lib/ipa_test_kit/generated/allergy_intolerance/metadata.yml +165 -0
  19. data/lib/ipa_test_kit/generated/allergy_intolerance_group.rb +85 -0
  20. data/lib/ipa_test_kit/generated/bmi/bmi_must_support_test.rb +49 -0
  21. data/lib/ipa_test_kit/generated/bmi/bmi_patient_category_date_search_test.rb +46 -0
  22. data/lib/ipa_test_kit/generated/bmi/bmi_patient_category_search_test.rb +45 -0
  23. data/lib/ipa_test_kit/generated/bmi/bmi_patient_category_status_search_test.rb +47 -0
  24. data/lib/ipa_test_kit/generated/bmi/bmi_patient_code_date_search_test.rb +48 -0
  25. data/lib/ipa_test_kit/generated/bmi/bmi_patient_code_search_test.rb +62 -0
  26. data/lib/ipa_test_kit/generated/bmi/bmi_provenance_revinclude_search_test.rb +51 -0
  27. data/lib/ipa_test_kit/generated/bmi/bmi_read_test.rb +24 -0
  28. data/lib/ipa_test_kit/generated/bmi/bmi_reference_resolution_test.rb +28 -0
  29. data/lib/ipa_test_kit/generated/bmi/bmi_validation_test.rb +34 -0
  30. data/lib/ipa_test_kit/generated/bmi/metadata.yml +322 -0
  31. data/lib/ipa_test_kit/generated/bmi_group.rb +93 -0
  32. data/lib/ipa_test_kit/generated/bodyheight/bodyheight_must_support_test.rb +49 -0
  33. data/lib/ipa_test_kit/generated/bodyheight/bodyheight_patient_category_date_search_test.rb +46 -0
  34. data/lib/ipa_test_kit/generated/bodyheight/bodyheight_patient_category_search_test.rb +45 -0
  35. data/lib/ipa_test_kit/generated/bodyheight/bodyheight_patient_category_status_search_test.rb +47 -0
  36. data/lib/ipa_test_kit/generated/bodyheight/bodyheight_patient_code_date_search_test.rb +48 -0
  37. data/lib/ipa_test_kit/generated/bodyheight/bodyheight_patient_code_search_test.rb +62 -0
  38. data/lib/ipa_test_kit/generated/bodyheight/bodyheight_provenance_revinclude_search_test.rb +51 -0
  39. data/lib/ipa_test_kit/generated/bodyheight/bodyheight_read_test.rb +24 -0
  40. data/lib/ipa_test_kit/generated/bodyheight/bodyheight_reference_resolution_test.rb +28 -0
  41. data/lib/ipa_test_kit/generated/bodyheight/bodyheight_validation_test.rb +34 -0
  42. data/lib/ipa_test_kit/generated/bodyheight/metadata.yml +328 -0
  43. data/lib/ipa_test_kit/generated/bodyheight_group.rb +93 -0
  44. data/lib/ipa_test_kit/generated/bodytemp/bodytemp_must_support_test.rb +49 -0
  45. data/lib/ipa_test_kit/generated/bodytemp/bodytemp_patient_category_date_search_test.rb +46 -0
  46. data/lib/ipa_test_kit/generated/bodytemp/bodytemp_patient_category_search_test.rb +45 -0
  47. data/lib/ipa_test_kit/generated/bodytemp/bodytemp_patient_category_status_search_test.rb +47 -0
  48. data/lib/ipa_test_kit/generated/bodytemp/bodytemp_patient_code_date_search_test.rb +48 -0
  49. data/lib/ipa_test_kit/generated/bodytemp/bodytemp_patient_code_search_test.rb +62 -0
  50. data/lib/ipa_test_kit/generated/bodytemp/bodytemp_provenance_revinclude_search_test.rb +51 -0
  51. data/lib/ipa_test_kit/generated/bodytemp/bodytemp_read_test.rb +24 -0
  52. data/lib/ipa_test_kit/generated/bodytemp/bodytemp_reference_resolution_test.rb +28 -0
  53. data/lib/ipa_test_kit/generated/bodytemp/bodytemp_validation_test.rb +34 -0
  54. data/lib/ipa_test_kit/generated/bodytemp/metadata.yml +328 -0
  55. data/lib/ipa_test_kit/generated/bodytemp_group.rb +93 -0
  56. data/lib/ipa_test_kit/generated/bodyweight/bodyweight_must_support_test.rb +49 -0
  57. data/lib/ipa_test_kit/generated/bodyweight/bodyweight_patient_category_date_search_test.rb +46 -0
  58. data/lib/ipa_test_kit/generated/bodyweight/bodyweight_patient_category_search_test.rb +45 -0
  59. data/lib/ipa_test_kit/generated/bodyweight/bodyweight_patient_category_status_search_test.rb +47 -0
  60. data/lib/ipa_test_kit/generated/bodyweight/bodyweight_patient_code_date_search_test.rb +48 -0
  61. data/lib/ipa_test_kit/generated/bodyweight/bodyweight_patient_code_search_test.rb +62 -0
  62. data/lib/ipa_test_kit/generated/bodyweight/bodyweight_provenance_revinclude_search_test.rb +51 -0
  63. data/lib/ipa_test_kit/generated/bodyweight/bodyweight_read_test.rb +24 -0
  64. data/lib/ipa_test_kit/generated/bodyweight/bodyweight_reference_resolution_test.rb +28 -0
  65. data/lib/ipa_test_kit/generated/bodyweight/bodyweight_validation_test.rb +34 -0
  66. data/lib/ipa_test_kit/generated/bodyweight/metadata.yml +328 -0
  67. data/lib/ipa_test_kit/generated/bodyweight_group.rb +93 -0
  68. data/lib/ipa_test_kit/generated/bp/bp_must_support_test.rb +52 -0
  69. data/lib/ipa_test_kit/generated/bp/bp_patient_category_date_search_test.rb +46 -0
  70. data/lib/ipa_test_kit/generated/bp/bp_patient_category_search_test.rb +45 -0
  71. data/lib/ipa_test_kit/generated/bp/bp_patient_category_status_search_test.rb +47 -0
  72. data/lib/ipa_test_kit/generated/bp/bp_patient_code_date_search_test.rb +48 -0
  73. data/lib/ipa_test_kit/generated/bp/bp_patient_code_search_test.rb +62 -0
  74. data/lib/ipa_test_kit/generated/bp/bp_provenance_revinclude_search_test.rb +51 -0
  75. data/lib/ipa_test_kit/generated/bp/bp_read_test.rb +24 -0
  76. data/lib/ipa_test_kit/generated/bp/bp_reference_resolution_test.rb +28 -0
  77. data/lib/ipa_test_kit/generated/bp/bp_validation_test.rb +34 -0
  78. data/lib/ipa_test_kit/generated/bp/metadata.yml +379 -0
  79. data/lib/ipa_test_kit/generated/bp_group.rb +93 -0
  80. data/lib/ipa_test_kit/generated/condition/condition_must_support_test.rb +39 -0
  81. data/lib/ipa_test_kit/generated/condition/condition_patient_category_search_test.rb +47 -0
  82. data/lib/ipa_test_kit/generated/condition/condition_patient_clinical_status_search_test.rb +46 -0
  83. data/lib/ipa_test_kit/generated/condition/condition_patient_code_search_test.rb +47 -0
  84. data/lib/ipa_test_kit/generated/condition/condition_patient_onset_date_search_test.rb +47 -0
  85. data/lib/ipa_test_kit/generated/condition/condition_patient_search_test.rb +60 -0
  86. data/lib/ipa_test_kit/generated/condition/condition_provenance_revinclude_search_test.rb +49 -0
  87. data/lib/ipa_test_kit/generated/condition/condition_read_test.rb +24 -0
  88. data/lib/ipa_test_kit/generated/condition/condition_reference_resolution_test.rb +28 -0
  89. data/lib/ipa_test_kit/generated/condition/condition_validation_test.rb +34 -0
  90. data/lib/ipa_test_kit/generated/condition/metadata.yml +231 -0
  91. data/lib/ipa_test_kit/generated/condition_group.rb +91 -0
  92. data/lib/ipa_test_kit/generated/document_reference/document_reference_id_search_test.rb +40 -0
  93. data/lib/ipa_test_kit/generated/document_reference/document_reference_must_support_test.rb +49 -0
  94. data/lib/ipa_test_kit/generated/document_reference/document_reference_patient_category_date_search_test.rb +46 -0
  95. data/lib/ipa_test_kit/generated/document_reference/document_reference_patient_category_search_test.rb +45 -0
  96. data/lib/ipa_test_kit/generated/document_reference/document_reference_patient_search_test.rb +61 -0
  97. data/lib/ipa_test_kit/generated/document_reference/document_reference_patient_status_search_test.rb +46 -0
  98. data/lib/ipa_test_kit/generated/document_reference/document_reference_patient_type_period_search_test.rb +48 -0
  99. data/lib/ipa_test_kit/generated/document_reference/document_reference_patient_type_search_test.rb +45 -0
  100. data/lib/ipa_test_kit/generated/document_reference/document_reference_provenance_revinclude_search_test.rb +50 -0
  101. data/lib/ipa_test_kit/generated/document_reference/document_reference_read_test.rb +24 -0
  102. data/lib/ipa_test_kit/generated/document_reference/document_reference_reference_resolution_test.rb +28 -0
  103. data/lib/ipa_test_kit/generated/document_reference/document_reference_validation_test.rb +34 -0
  104. data/lib/ipa_test_kit/generated/document_reference/metadata.yml +356 -0
  105. data/lib/ipa_test_kit/generated/document_reference_group.rb +99 -0
  106. data/lib/ipa_test_kit/generated/head_circumference/head_circumference_must_support_test.rb +49 -0
  107. data/lib/ipa_test_kit/generated/head_circumference/head_circumference_patient_category_date_search_test.rb +46 -0
  108. data/lib/ipa_test_kit/generated/head_circumference/head_circumference_patient_category_search_test.rb +45 -0
  109. data/lib/ipa_test_kit/generated/head_circumference/head_circumference_patient_category_status_search_test.rb +47 -0
  110. data/lib/ipa_test_kit/generated/head_circumference/head_circumference_patient_code_date_search_test.rb +48 -0
  111. data/lib/ipa_test_kit/generated/head_circumference/head_circumference_patient_code_search_test.rb +62 -0
  112. data/lib/ipa_test_kit/generated/head_circumference/head_circumference_provenance_revinclude_search_test.rb +51 -0
  113. data/lib/ipa_test_kit/generated/head_circumference/head_circumference_read_test.rb +24 -0
  114. data/lib/ipa_test_kit/generated/head_circumference/head_circumference_reference_resolution_test.rb +28 -0
  115. data/lib/ipa_test_kit/generated/head_circumference/head_circumference_validation_test.rb +34 -0
  116. data/lib/ipa_test_kit/generated/head_circumference/metadata.yml +324 -0
  117. data/lib/ipa_test_kit/generated/head_circumference_group.rb +93 -0
  118. data/lib/ipa_test_kit/generated/heartrate/heartrate_must_support_test.rb +49 -0
  119. data/lib/ipa_test_kit/generated/heartrate/heartrate_patient_category_date_search_test.rb +46 -0
  120. data/lib/ipa_test_kit/generated/heartrate/heartrate_patient_category_search_test.rb +45 -0
  121. data/lib/ipa_test_kit/generated/heartrate/heartrate_patient_category_status_search_test.rb +47 -0
  122. data/lib/ipa_test_kit/generated/heartrate/heartrate_patient_code_date_search_test.rb +48 -0
  123. data/lib/ipa_test_kit/generated/heartrate/heartrate_patient_code_search_test.rb +62 -0
  124. data/lib/ipa_test_kit/generated/heartrate/heartrate_provenance_revinclude_search_test.rb +51 -0
  125. data/lib/ipa_test_kit/generated/heartrate/heartrate_read_test.rb +24 -0
  126. data/lib/ipa_test_kit/generated/heartrate/heartrate_reference_resolution_test.rb +28 -0
  127. data/lib/ipa_test_kit/generated/heartrate/heartrate_validation_test.rb +34 -0
  128. data/lib/ipa_test_kit/generated/heartrate/metadata.yml +325 -0
  129. data/lib/ipa_test_kit/generated/heartrate_group.rb +93 -0
  130. data/lib/ipa_test_kit/generated/immunization/immunization_must_support_test.rb +40 -0
  131. data/lib/ipa_test_kit/generated/immunization/immunization_patient_date_search_test.rb +47 -0
  132. data/lib/ipa_test_kit/generated/immunization/immunization_patient_search_test.rb +60 -0
  133. data/lib/ipa_test_kit/generated/immunization/immunization_patient_status_search_test.rb +45 -0
  134. data/lib/ipa_test_kit/generated/immunization/immunization_provenance_revinclude_search_test.rb +50 -0
  135. data/lib/ipa_test_kit/generated/immunization/immunization_read_test.rb +24 -0
  136. data/lib/ipa_test_kit/generated/immunization/immunization_reference_resolution_test.rb +28 -0
  137. data/lib/ipa_test_kit/generated/immunization/immunization_validation_test.rb +34 -0
  138. data/lib/ipa_test_kit/generated/immunization/metadata.yml +210 -0
  139. data/lib/ipa_test_kit/generated/immunization_group.rb +87 -0
  140. data/lib/ipa_test_kit/generated/ipa_test_suite.rb +88 -0
  141. data/lib/ipa_test_kit/generated/medication_request/medication_request_must_support_test.rb +44 -0
  142. data/lib/ipa_test_kit/generated/medication_request/medication_request_patient_intent_authoredon_search_test.rb +53 -0
  143. data/lib/ipa_test_kit/generated/medication_request/medication_request_patient_intent_encounter_search_test.rb +52 -0
  144. data/lib/ipa_test_kit/generated/medication_request/medication_request_patient_intent_search_test.rb +68 -0
  145. data/lib/ipa_test_kit/generated/medication_request/medication_request_patient_intent_status_search_test.rb +49 -0
  146. data/lib/ipa_test_kit/generated/medication_request/medication_request_provenance_revinclude_search_test.rb +51 -0
  147. data/lib/ipa_test_kit/generated/medication_request/medication_request_read_test.rb +24 -0
  148. data/lib/ipa_test_kit/generated/medication_request/medication_request_reference_resolution_test.rb +28 -0
  149. data/lib/ipa_test_kit/generated/medication_request/medication_request_validation_test.rb +34 -0
  150. data/lib/ipa_test_kit/generated/medication_request/medication_validation_test.rb +34 -0
  151. data/lib/ipa_test_kit/generated/medication_request/metadata.yml +307 -0
  152. data/lib/ipa_test_kit/generated/medication_request_group.rb +92 -0
  153. data/lib/ipa_test_kit/generated/medication_statement/medication_statement_must_support_test.rb +43 -0
  154. data/lib/ipa_test_kit/generated/medication_statement/medication_statement_patient_context_search_test.rb +51 -0
  155. data/lib/ipa_test_kit/generated/medication_statement/medication_statement_patient_effective_search_test.rb +52 -0
  156. data/lib/ipa_test_kit/generated/medication_statement/medication_statement_patient_search_test.rb +68 -0
  157. data/lib/ipa_test_kit/generated/medication_statement/medication_statement_patient_status_search_test.rb +49 -0
  158. data/lib/ipa_test_kit/generated/medication_statement/medication_statement_provenance_revinclude_search_test.rb +51 -0
  159. data/lib/ipa_test_kit/generated/medication_statement/medication_statement_read_test.rb +24 -0
  160. data/lib/ipa_test_kit/generated/medication_statement/medication_statement_reference_resolution_test.rb +28 -0
  161. data/lib/ipa_test_kit/generated/medication_statement/medication_statement_validation_test.rb +34 -0
  162. data/lib/ipa_test_kit/generated/medication_statement/medication_validation_test.rb +34 -0
  163. data/lib/ipa_test_kit/generated/medication_statement/metadata.yml +230 -0
  164. data/lib/ipa_test_kit/generated/medication_statement_group.rb +92 -0
  165. data/lib/ipa_test_kit/generated/metadata.yml +6230 -0
  166. data/lib/ipa_test_kit/generated/observation/metadata.yml +1280 -0
  167. data/lib/ipa_test_kit/generated/observation/observation_must_support_test.rb +41 -0
  168. data/lib/ipa_test_kit/generated/observation/observation_patient_category_date_search_test.rb +46 -0
  169. data/lib/ipa_test_kit/generated/observation/observation_patient_category_search_test.rb +62 -0
  170. data/lib/ipa_test_kit/generated/observation/observation_patient_category_status_search_test.rb +47 -0
  171. data/lib/ipa_test_kit/generated/observation/observation_patient_code_date_search_test.rb +48 -0
  172. data/lib/ipa_test_kit/generated/observation/observation_patient_code_search_test.rb +45 -0
  173. data/lib/ipa_test_kit/generated/observation/observation_provenance_revinclude_search_test.rb +51 -0
  174. data/lib/ipa_test_kit/generated/observation/observation_read_test.rb +24 -0
  175. data/lib/ipa_test_kit/generated/observation/observation_reference_resolution_test.rb +28 -0
  176. data/lib/ipa_test_kit/generated/observation/observation_validation_test.rb +34 -0
  177. data/lib/ipa_test_kit/generated/observation_group.rb +93 -0
  178. data/lib/ipa_test_kit/generated/oxygensat/metadata.yml +366 -0
  179. data/lib/ipa_test_kit/generated/oxygensat/oxygensat_must_support_test.rb +65 -0
  180. data/lib/ipa_test_kit/generated/oxygensat/oxygensat_patient_category_date_search_test.rb +46 -0
  181. data/lib/ipa_test_kit/generated/oxygensat/oxygensat_patient_category_search_test.rb +45 -0
  182. data/lib/ipa_test_kit/generated/oxygensat/oxygensat_patient_category_status_search_test.rb +47 -0
  183. data/lib/ipa_test_kit/generated/oxygensat/oxygensat_patient_code_date_search_test.rb +48 -0
  184. data/lib/ipa_test_kit/generated/oxygensat/oxygensat_patient_code_search_test.rb +62 -0
  185. data/lib/ipa_test_kit/generated/oxygensat/oxygensat_provenance_revinclude_search_test.rb +51 -0
  186. data/lib/ipa_test_kit/generated/oxygensat/oxygensat_read_test.rb +24 -0
  187. data/lib/ipa_test_kit/generated/oxygensat/oxygensat_reference_resolution_test.rb +28 -0
  188. data/lib/ipa_test_kit/generated/oxygensat/oxygensat_validation_test.rb +34 -0
  189. data/lib/ipa_test_kit/generated/oxygensat_group.rb +93 -0
  190. data/lib/ipa_test_kit/generated/patient/metadata.yml +320 -0
  191. data/lib/ipa_test_kit/generated/patient/patient_birthdate_family_search_test.rb +41 -0
  192. data/lib/ipa_test_kit/generated/patient/patient_birthdate_name_search_test.rb +39 -0
  193. data/lib/ipa_test_kit/generated/patient/patient_family_gender_search_test.rb +41 -0
  194. data/lib/ipa_test_kit/generated/patient/patient_gender_name_search_test.rb +39 -0
  195. data/lib/ipa_test_kit/generated/patient/patient_id_search_test.rb +53 -0
  196. data/lib/ipa_test_kit/generated/patient/patient_identifier_search_test.rb +40 -0
  197. data/lib/ipa_test_kit/generated/patient/patient_must_support_test.rb +57 -0
  198. data/lib/ipa_test_kit/generated/patient/patient_name_search_test.rb +39 -0
  199. data/lib/ipa_test_kit/generated/patient/patient_provenance_revinclude_search_test.rb +49 -0
  200. data/lib/ipa_test_kit/generated/patient/patient_read_test.rb +24 -0
  201. data/lib/ipa_test_kit/generated/patient/patient_reference_resolution_test.rb +28 -0
  202. data/lib/ipa_test_kit/generated/patient/patient_validation_test.rb +34 -0
  203. data/lib/ipa_test_kit/generated/patient_group.rb +99 -0
  204. data/lib/ipa_test_kit/generated/practitioner/metadata.yml +124 -0
  205. data/lib/ipa_test_kit/generated/practitioner/practitioner_identifier_search_test.rb +40 -0
  206. data/lib/ipa_test_kit/generated/practitioner/practitioner_must_support_test.rb +40 -0
  207. data/lib/ipa_test_kit/generated/practitioner/practitioner_name_search_test.rb +49 -0
  208. data/lib/ipa_test_kit/generated/practitioner/practitioner_read_test.rb +24 -0
  209. data/lib/ipa_test_kit/generated/practitioner/practitioner_reference_resolution_test.rb +28 -0
  210. data/lib/ipa_test_kit/generated/practitioner/practitioner_validation_test.rb +34 -0
  211. data/lib/ipa_test_kit/generated/practitioner_group.rb +84 -0
  212. data/lib/ipa_test_kit/generated/practitioner_role/metadata.yml +141 -0
  213. data/lib/ipa_test_kit/generated/practitioner_role/practitioner_role_identifier_search_test.rb +40 -0
  214. data/lib/ipa_test_kit/generated/practitioner_role/practitioner_role_must_support_test.rb +40 -0
  215. data/lib/ipa_test_kit/generated/practitioner_role/practitioner_role_practitioner_search_test.rb +51 -0
  216. data/lib/ipa_test_kit/generated/practitioner_role/practitioner_role_read_test.rb +24 -0
  217. data/lib/ipa_test_kit/generated/practitioner_role/practitioner_role_reference_resolution_test.rb +28 -0
  218. data/lib/ipa_test_kit/generated/practitioner_role/practitioner_role_validation_test.rb +34 -0
  219. data/lib/ipa_test_kit/generated/practitioner_role_group.rb +84 -0
  220. data/lib/ipa_test_kit/generated/provenance/metadata.yml +114 -0
  221. data/lib/ipa_test_kit/generated/provenance/provenance_read_test.rb +24 -0
  222. data/lib/ipa_test_kit/generated/provenance/provenance_reference_resolution_test.rb +28 -0
  223. data/lib/ipa_test_kit/generated/provenance/provenance_validation_test.rb +34 -0
  224. data/lib/ipa_test_kit/generated/provenance_group.rb +53 -0
  225. data/lib/ipa_test_kit/generated/resource_list.rb +18 -0
  226. data/lib/ipa_test_kit/generated/resprate/metadata.yml +325 -0
  227. data/lib/ipa_test_kit/generated/resprate/resprate_must_support_test.rb +49 -0
  228. data/lib/ipa_test_kit/generated/resprate/resprate_patient_category_date_search_test.rb +46 -0
  229. data/lib/ipa_test_kit/generated/resprate/resprate_patient_category_search_test.rb +45 -0
  230. data/lib/ipa_test_kit/generated/resprate/resprate_patient_category_status_search_test.rb +47 -0
  231. data/lib/ipa_test_kit/generated/resprate/resprate_patient_code_date_search_test.rb +48 -0
  232. data/lib/ipa_test_kit/generated/resprate/resprate_patient_code_search_test.rb +62 -0
  233. data/lib/ipa_test_kit/generated/resprate/resprate_provenance_revinclude_search_test.rb +51 -0
  234. data/lib/ipa_test_kit/generated/resprate/resprate_read_test.rb +24 -0
  235. data/lib/ipa_test_kit/generated/resprate/resprate_reference_resolution_test.rb +28 -0
  236. data/lib/ipa_test_kit/generated/resprate/resprate_validation_test.rb +34 -0
  237. data/lib/ipa_test_kit/generated/resprate_group.rb +93 -0
  238. data/lib/ipa_test_kit/generator/group_generator.rb +171 -0
  239. data/lib/ipa_test_kit/generator/group_metadata.rb +98 -0
  240. data/lib/ipa_test_kit/generator/group_metadata_extractor.rb +278 -0
  241. data/lib/ipa_test_kit/generator/ig_loader.rb +63 -0
  242. data/lib/ipa_test_kit/generator/ig_metadata.rb +49 -0
  243. data/lib/ipa_test_kit/generator/ig_metadata_extractor.rb +56 -0
  244. data/lib/ipa_test_kit/generator/ig_resources.rb +48 -0
  245. data/lib/ipa_test_kit/generator/must_support_metadata_extractor.rb +221 -0
  246. data/lib/ipa_test_kit/generator/must_support_test_generator.rb +86 -0
  247. data/lib/ipa_test_kit/generator/naming.rb +46 -0
  248. data/lib/ipa_test_kit/generator/provenance_revinclude_search_test_generator.rb +186 -0
  249. data/lib/ipa_test_kit/generator/read_test_generator.rb +89 -0
  250. data/lib/ipa_test_kit/generator/reference_resolution_test_generator.rb +72 -0
  251. data/lib/ipa_test_kit/generator/resource_list_generator.rb +46 -0
  252. data/lib/ipa_test_kit/generator/search_definition_metadata_extractor.rb +181 -0
  253. data/lib/ipa_test_kit/generator/search_metadata_extractor.rb +74 -0
  254. data/lib/ipa_test_kit/generator/search_test_generator.rb +295 -0
  255. data/lib/ipa_test_kit/generator/special_cases.rb +16 -0
  256. data/lib/ipa_test_kit/generator/suite_generator.rb +67 -0
  257. data/lib/ipa_test_kit/generator/terminology_binding_metadata_extractor.rb +105 -0
  258. data/lib/ipa_test_kit/generator/validation_test_generator.rb +124 -0
  259. data/lib/ipa_test_kit/generator.rb +86 -0
  260. data/lib/ipa_test_kit/igs/package.tgz +0 -0
  261. data/lib/ipa_test_kit/must_support_test.rb +146 -0
  262. data/lib/ipa_test_kit/read_test.rb +62 -0
  263. data/lib/ipa_test_kit/reference_resolution_test.rb +111 -0
  264. data/lib/ipa_test_kit/request_logger.rb +46 -0
  265. data/lib/ipa_test_kit/search_test.rb +728 -0
  266. data/lib/ipa_test_kit/search_test_properties.rb +61 -0
  267. data/lib/ipa_test_kit/validation_test.rb +48 -0
  268. data/lib/ipa_test_kit/version.rb +3 -0
  269. data/lib/ipa_test_kit.rb +2 -0
  270. metadata +397 -0
@@ -0,0 +1,221 @@
1
+ module IpaTestKit
2
+ class Generator
3
+ class MustSupportMetadataExtractor
4
+ attr_accessor :profile_elements, :profile, :resource
5
+
6
+ def initialize(profile_elements, profile, resource)
7
+ self.profile_elements = profile_elements
8
+ self.profile = profile
9
+ self.resource = resource
10
+ end
11
+
12
+ def must_supports
13
+ {
14
+ extensions: must_support_extensions,
15
+ slices: must_support_slices,
16
+ elements: must_support_elements
17
+ }
18
+ end
19
+
20
+ # exclude component from vital sign profiles except observation-bp and observation-pulse-ox
21
+ # observation-bp is excluded by profile.name != 'observation-bp'
22
+ # observation-plux-ox is excluded by profile.baseDefinition == 'http://hl7.org/fhir/StructureDefinition/vitalsigns'
23
+ def vital_signs_component?(element)
24
+ profile.baseDefinition == 'http://hl7.org/fhir/StructureDefinition/vitalsigns' &&
25
+ profile.name != 'observation-bp' &&
26
+ element.path.include?('component')
27
+ end
28
+
29
+ def blood_pressure_value?(element)
30
+ profile.name == 'observation-bp' && element.path.include?('Observation.value[x]')
31
+ end
32
+
33
+ # ONC clarified that health IT developers that always provide HL7 FHIR "observation" values
34
+ # are not required to demonstrate Health IT Module support for "dataAbsentReason" elements.
35
+ # Remove MS check for dataAbsentReason and component.dataAbsentReason from vital sign profiles
36
+ def data_absent_reason?(element)
37
+ profile.type == 'Observation' && ['Observation.dataAbsentReason', 'Observation.component.dataAbsentReason'].include?(element.path)
38
+ end
39
+
40
+ def all_must_support_elements
41
+ profile_elements
42
+ .select { |element| element.mustSupport }
43
+ .reject do |element|
44
+ # TODO: Can special cases be moved out of here?
45
+ vital_signs_component?(element) || blood_pressure_value?(element) || data_absent_reason?(element)
46
+ end
47
+ end
48
+
49
+ def must_support_extension_elements
50
+ all_must_support_elements.select { |element| element.path.end_with? 'extension' }
51
+ end
52
+
53
+ def must_support_extensions
54
+ must_support_extension_elements.map do |element|
55
+ {
56
+ id: element.id,
57
+ url: element.type.first.profile.first
58
+ }
59
+ end
60
+ end
61
+
62
+ def must_support_slice_elements
63
+ all_must_support_elements.select { |element| !element.path.end_with?('extension') && element.sliceName.present? }
64
+ end
65
+
66
+ def sliced_element(slice)
67
+ profile_elements.find { |element| element.id == slice.path }
68
+ end
69
+
70
+ def discriminators(slice)
71
+ slice.slicing.discriminator
72
+ end
73
+
74
+ def must_support_pattern_slice_elements
75
+ must_support_slice_elements.select do |element|
76
+ discriminators(sliced_element(element)).first.type == 'pattern'
77
+ end
78
+ end
79
+
80
+ def pattern_slices
81
+ must_support_pattern_slice_elements.map do |current_element|
82
+ {
83
+ name: current_element.id,
84
+ path: current_element.path.gsub("#{resource}.", '')
85
+ }.tap do |metadata|
86
+ discriminator = discriminators(sliced_element(current_element)).first
87
+ discriminator_path = discriminator.path
88
+ discriminator_path = '' if discriminator_path == '$this'
89
+ pattern_element =
90
+ if discriminator_path.present?
91
+ profile_elements.find { |element| element.id == "#{current_element.id}.#{discriminator_path}" }
92
+ else
93
+ current_element
94
+ end
95
+
96
+ metadata[:discriminator] =
97
+ if pattern_element.patternCodeableConcept.present?
98
+ {
99
+ type: 'patternCodeableConcept',
100
+ path: discriminator_path,
101
+ code: pattern_element.patternCodeableConcept.coding.first.code,
102
+ system: pattern_element.patternCodeableConcept.coding.first.system
103
+ }
104
+ elsif pattern_element.patternIdentifier.present?
105
+ {
106
+ type: 'patternIdentifier',
107
+ path: discriminator_path,
108
+ system: pattern_element.patternIdentifier.system
109
+ }
110
+ else
111
+ raise StandardError, 'Unsupported discriminator pattern type'
112
+ end
113
+ end
114
+ end
115
+ end
116
+
117
+ def must_support_type_slice_elements
118
+ must_support_slice_elements.select do |element|
119
+ discriminators(sliced_element(element)).first.type == 'type'
120
+ end
121
+ end
122
+
123
+ def type_slices
124
+ must_support_type_slice_elements.map do |current_element|
125
+ discriminator = discriminators(sliced_element(current_element)).first
126
+ type_path = discriminator.path
127
+ type_path = '' if type_path == '$this'
128
+ type_element =
129
+ if type_path.present?
130
+ elements.find { |element| element.id == "#{current_element.id}.#{type_path}" }
131
+ else
132
+ current_element
133
+ end
134
+
135
+ type_code = type_element.type.first.code
136
+
137
+ {
138
+ name: current_element.id,
139
+ path: current_element.path.gsub("#{resource}.", ''),
140
+ discriminator: {
141
+ type: 'type',
142
+ code: type_code.upcase_first
143
+ }
144
+ }
145
+ end
146
+ end
147
+
148
+ def must_support_value_slice_elements
149
+ must_support_slice_elements.select do |element|
150
+ discriminators(sliced_element(element)).first.type == 'value'
151
+ end
152
+ end
153
+
154
+ def value_slices
155
+ must_support_value_slice_elements.map do |current_element|
156
+ {
157
+ name: current_element.id,
158
+ path: current_element.path.gsub("#{resource}.", ''),
159
+ discriminator: {
160
+ type: 'value'
161
+ }
162
+ }.tap do |metadata|
163
+ metadata[:discriminator][:values] = discriminators(sliced_element(current_element)).map do |discriminator|
164
+ fixed_element = profile_elements.find do |element|
165
+ element.id.starts_with?(current_element.id) &&
166
+ element.path == "#{current_element.path}.#{discriminator.path}"
167
+ end
168
+
169
+ binding.pry if fixed_element.nil?
170
+ {
171
+ path: discriminator.path,
172
+ value: fixed_element.fixedUri || fixed_element.fixedCode
173
+ }
174
+ end
175
+ end
176
+ end
177
+ end
178
+
179
+ def must_support_slices
180
+ pattern_slices + type_slices + value_slices
181
+ end
182
+
183
+ def plain_must_support_elements
184
+ all_must_support_elements - must_support_extension_elements - must_support_slice_elements
185
+ end
186
+
187
+ def handle_fixed_values(metadata, element)
188
+ if element.fixedUri.present?
189
+ metadata[:fixed_value] = element.fixedUri
190
+ elsif element.patternCodeableConcept.present?
191
+ metadata[:fixed_value] = element.patternCodeableConcept.coding.first.code
192
+ metadata[:path] += '.coding.code'
193
+ elsif element.fixedCode.present?
194
+ metadata[:fixed_value] = element.fixedCode
195
+ elsif element.patternIdentifier.present?
196
+ metadata[:fixed_value] = element.patternIdentifier.system
197
+ metadata[:path] += '.system'
198
+ end
199
+ end
200
+
201
+ def must_support_elements
202
+ plain_must_support_elements.each_with_object([]) do |current_element, must_support_elements_metadata|
203
+ {
204
+ path: current_element.path.gsub("#{resource}.", '')
205
+ }.tap do |current_metadata|
206
+ path = current_element.path.gsub("#{resource}.", '')
207
+ current_metadata[:path] = path
208
+
209
+ handle_fixed_values(current_metadata, current_element)
210
+
211
+ must_support_elements_metadata.delete_if do |metadata|
212
+ metadata[:path] == current_metadata[:path] && metadata[:fixed_value].blank?
213
+ end
214
+
215
+ must_support_elements_metadata << current_metadata
216
+ end
217
+ end.uniq
218
+ end
219
+ end
220
+ end
221
+ end
@@ -0,0 +1,86 @@
1
+ require_relative 'naming'
2
+ require_relative 'special_cases'
3
+
4
+ module IpaTestKit
5
+ class Generator
6
+ class MustSupportTestGenerator
7
+ class << self
8
+ def generate(ig_metadata)
9
+ ig_metadata.groups
10
+ .reject { |group| SpecialCases.exclude_resource? group.resource }
11
+ .each { |group| new(group).generate }
12
+ end
13
+ end
14
+
15
+ attr_accessor :group_metadata
16
+
17
+ def initialize(group_metadata)
18
+ self.group_metadata = group_metadata
19
+ end
20
+
21
+ def template
22
+ @template ||= File.read(File.join(__dir__, 'templates', 'must_support.rb.erb'))
23
+ end
24
+
25
+ def output
26
+ @output ||= ERB.new(template).result(binding)
27
+ end
28
+
29
+ def base_output_file_name
30
+ "#{class_name.underscore}.rb"
31
+ end
32
+
33
+ def output_file_directory
34
+ File.join(__dir__, '..', 'generated', profile_identifier)
35
+ end
36
+
37
+ def output_file_name
38
+ File.join(output_file_directory, base_output_file_name)
39
+ end
40
+
41
+ def read_interaction
42
+ self.class.read_interaction(group_metadata)
43
+ end
44
+
45
+ def profile_identifier
46
+ Naming.snake_case_for_profile(group_metadata)
47
+ end
48
+
49
+ def test_id
50
+ "ipa_010_#{profile_identifier}_must_support_test"
51
+ end
52
+
53
+ def class_name
54
+ "#{Naming.upper_camel_case_for_profile(group_metadata)}MustSupportTest"
55
+ end
56
+
57
+ def resource_type
58
+ group_metadata.resource
59
+ end
60
+
61
+ def resource_collection_string
62
+ 'all_scratch_resources'
63
+ end
64
+
65
+ def must_support_list_string
66
+ slice_names = group_metadata.must_supports[:slices].map { |slice| slice[:name] }
67
+ element_names = group_metadata.must_supports[:elements].map { |slice| "#{resource_type}.#{slice[:path]}" }
68
+ extension_names = group_metadata.must_supports[:extensions].map { |slice| slice[:id] }
69
+ (slice_names + element_names + extension_names)
70
+ .sort
71
+ .map { |name| " * #{name}" }
72
+ .join("\n")
73
+ end
74
+
75
+ def generate
76
+ FileUtils.mkdir_p(output_file_directory)
77
+ File.open(output_file_name, 'w') { |f| f.write(output) }
78
+
79
+ group_metadata.add_test(
80
+ id: test_id,
81
+ file_name: base_output_file_name
82
+ )
83
+ end
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,46 @@
1
+ module IpaTestKit
2
+ class Generator
3
+ module Naming
4
+ ALLERGY_INTOLERANCE = 'http://hl7.org/fhir/uv/ipa/StructureDefinition/ipa-allergyintolerance'
5
+ CONDITION = 'http://hl7.org/fhir/uv/ipa/StructureDefinition/ipa-condition'
6
+ DOCUMENT_REFERENCE = 'http://hl7.org/fhir/uv/ipa/StructureDefinition/ipa-documentreference'
7
+ IMMUNIZATION = 'http://hl7.org/fhir/uv/ipa/StructureDefinition/ipa-immunization'
8
+ MEDICATION = 'http://hl7.org/fhir/uv/ipa/StructureDefinition/ipa-medication'
9
+ MEDICATION_REQUEST = 'http://hl7.org/fhir/uv/ipa/StructureDefinition/ipa-medicationrequest'
10
+ MEDICATION_STATEMENT = 'http://hl7.org/fhir/uv/ipa/StructureDefinition/ipa-medicationstatement'
11
+ OBSERVATION = 'http://hl7.org/fhir/uv/ipa/StructureDefinition/ipa-observation'
12
+ BMI = 'http://hl7.org/fhir/StructureDefinition/bmi'
13
+ OXYGEN_SAT = 'http://hl7.org/fhir/StructureDefinition/oxygensat'
14
+ HEAD_CIRCUMFERENCE = 'http://hl7.org/fhir/StructureDefinition/headcircum'
15
+ PATIENT = 'http://hl7.org/fhir/uv/ipa/StructureDefinition/ipa-patient'
16
+ PRACTITIONER = 'http://hl7.org/fhir/uv/ipa/StructureDefinition/ipa-practitioner'
17
+ PRACTITIONER_ROLE = 'http://hl7.org/fhir/uv/ipa/StructureDefinition/ipa-practitionerrole'
18
+ PROVENANCE = 'http://hl7.org/fhir/uv/ipa/StructureDefinition/ipa-provenance'
19
+
20
+ class << self
21
+ def resources_with_multiple_profiles
22
+ ['Observation']
23
+ end
24
+
25
+ def resource_has_multiple_profiles?(resource)
26
+ resources_with_multiple_profiles.include? resource
27
+ end
28
+
29
+ def snake_case_for_profile(group_metadata)
30
+ resource = group_metadata.resource
31
+ return resource.underscore unless resource_has_multiple_profiles?(resource)
32
+
33
+ return 'head_circumference' if group_metadata.profile_url == HEAD_CIRCUMFERENCE
34
+
35
+ group_metadata.name
36
+ .delete_prefix('ipa_')
37
+ .underscore
38
+ end
39
+
40
+ def upper_camel_case_for_profile(group_metadata)
41
+ snake_case_for_profile(group_metadata).camelize
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,186 @@
1
+ require_relative 'naming'
2
+ require_relative 'special_cases'
3
+
4
+ module IpaTestKit
5
+ class Generator
6
+ class ProvenanceRevincludeSearchTestGenerator
7
+ class << self
8
+ def generate(ig_metadata)
9
+ ig_metadata.groups
10
+ .reject { |group| SpecialCases.exclude_resource? group.resource }
11
+ .select { |group| group.revincludes.include? 'Provenance:target' }
12
+ .each { |group| new(group, group.searches.first).generate }
13
+ end
14
+ end
15
+
16
+ attr_accessor :group_metadata, :search_metadata
17
+
18
+ def initialize(group_metadata, search_metadata)
19
+ self.group_metadata = group_metadata
20
+ self.search_metadata = search_metadata
21
+ end
22
+
23
+ def template
24
+ @template ||= File.read(File.join(__dir__, 'templates', 'provenance_revinclude_search.rb.erb'))
25
+ end
26
+
27
+ def output
28
+ @output ||= ERB.new(template).result(binding)
29
+ end
30
+
31
+ def base_output_file_name
32
+ "#{class_name.underscore}.rb"
33
+ end
34
+
35
+ def output_file_directory
36
+ File.join(__dir__, '..', 'generated', profile_identifier)
37
+ end
38
+
39
+ def output_file_name
40
+ File.join(output_file_directory, base_output_file_name)
41
+ end
42
+
43
+ def profile_identifier
44
+ Naming.snake_case_for_profile(group_metadata)
45
+ end
46
+
47
+ def test_id
48
+ "ipa_010_#{profile_identifier}_#{search_identifier}_search_test"
49
+ end
50
+
51
+ def search_identifier
52
+ 'provenance_revinclude'
53
+ end
54
+
55
+ def search_title
56
+ search_identifier.camelize
57
+ end
58
+
59
+ def class_name
60
+ "#{Naming.upper_camel_case_for_profile(group_metadata)}#{search_title}SearchTest"
61
+ end
62
+
63
+ def resource_type
64
+ group_metadata.resource
65
+ end
66
+
67
+ def search_params
68
+ @search_params ||=
69
+ search_metadata[:names].map do |name|
70
+ {
71
+ name: name,
72
+ path: search_definition(name)[:path]
73
+ }
74
+ end
75
+ end
76
+
77
+ def first_search?
78
+ group_metadata.searches.first == search_metadata
79
+ end
80
+
81
+ def fixed_value_search?
82
+ search_metadata[:names] != ['patient'] &&
83
+ !group_metadata.delayed? && resource_type != 'Patient'
84
+ end
85
+
86
+ def fixed_value_search_param_name
87
+ (search_metadata[:names] - [:patient]).first
88
+ end
89
+
90
+ def search_param_name_string
91
+ search_metadata[:names].join(' + ') + ' + revInclude:Provenance:target'
92
+ end
93
+
94
+ def needs_patient_id?
95
+ search_metadata[:names].include?('patient') ||
96
+ (resource_type == 'Patient' && search_metadata[:names].include?('_id'))
97
+ end
98
+
99
+ def search_param_names
100
+ search_params.map { |param| param[:name] }
101
+ end
102
+
103
+ def search_param_names_array
104
+ array_of_strings(search_param_names)
105
+ end
106
+
107
+ def path_for_value(path)
108
+ path == 'class' ? 'local_class' : path
109
+ end
110
+
111
+ def required_comparators_for_param(name)
112
+ search_definition(name)[:comparators].select { |_comparator, expectation| expectation == 'SHALL' }
113
+ end
114
+
115
+ def required_comparators
116
+ @required_comparators ||=
117
+ search_param_names.each_with_object({}) do |name, comparators|
118
+ required_comparators = required_comparators_for_param(name)
119
+ comparators[name] = required_comparators if required_comparators.present?
120
+ end
121
+ end
122
+
123
+ # def patient_id_param?(param)
124
+ # param[:name] == 'patient' ||
125
+ # (resource_type == 'Patient' && param[:name] == '_id')
126
+ # end
127
+
128
+ def search_definition(name)
129
+ group_metadata.search_definitions[name.to_sym]
130
+ end
131
+
132
+ def saves_delayed_references?
133
+ first_search? && group_metadata.delayed_references.present?
134
+ end
135
+
136
+ def possible_status_search?
137
+ !search_metadata[:names].include?('status') && group_metadata.search_definitions.key?(:status)
138
+ end
139
+
140
+ def token_search_params
141
+ @token_search_params ||=
142
+ search_param_names.select do |name|
143
+ ['Identifier', 'CodeableConcept', 'Coding'].include? group_metadata.search_definitions[name.to_sym][:type]
144
+ end
145
+ end
146
+
147
+ def token_search_params_string
148
+ array_of_strings(token_search_params)
149
+ end
150
+
151
+ def required_comparators_string
152
+ array_of_strings(required_comparators.keys)
153
+ end
154
+
155
+ def array_of_strings(array)
156
+ quoted_strings = array.map { |element| "'#{element}'" }
157
+ "[#{quoted_strings.join(', ')}]"
158
+ end
159
+
160
+ def search_properties
161
+ {}.tap do |properties|
162
+ properties[:fixed_value_search] = 'true' if fixed_value_search?
163
+ properties[:resource_type] = "'#{resource_type}'"
164
+ properties[:search_param_names] = search_param_names_array
165
+ properties[:possible_status_search] = 'true' if possible_status_search?
166
+ end
167
+ end
168
+
169
+ def search_test_properties_string
170
+ search_properties
171
+ .map { |key, value| "#{' ' * 8}#{key}: #{value}" }
172
+ .join(",\n")
173
+ end
174
+
175
+ def generate
176
+ FileUtils.mkdir_p(output_file_directory)
177
+ File.open(output_file_name, 'w') { |f| f.write(output) }
178
+
179
+ group_metadata.add_test(
180
+ id: test_id,
181
+ file_name: base_output_file_name
182
+ )
183
+ end
184
+ end
185
+ end
186
+ end
@@ -0,0 +1,89 @@
1
+ require_relative 'naming'
2
+ require_relative 'special_cases'
3
+
4
+ module IpaTestKit
5
+ class Generator
6
+ class ReadTestGenerator
7
+ class << self
8
+ def generate(ig_metadata)
9
+ ig_metadata.groups
10
+ .reject { |group| SpecialCases.exclude_resource? group.resource }
11
+ .select { |group| read_interaction(group).present? }
12
+ .each { |group| new(group).generate }
13
+ end
14
+
15
+ def read_interaction(group_metadata)
16
+ group_metadata.interactions.find { |interaction| interaction[:code] == 'read' }
17
+ end
18
+ end
19
+
20
+ attr_accessor :group_metadata
21
+
22
+ def initialize(group_metadata)
23
+ self.group_metadata = group_metadata
24
+ end
25
+
26
+ def template
27
+ @template ||= File.read(File.join(__dir__, 'templates', 'read.rb.erb'))
28
+ end
29
+
30
+ def output
31
+ @output ||= ERB.new(template).result(binding)
32
+ end
33
+
34
+ def base_output_file_name
35
+ "#{class_name.underscore}.rb"
36
+ end
37
+
38
+ def output_file_directory
39
+ File.join(__dir__, '..', 'generated', profile_identifier)
40
+ end
41
+
42
+ def output_file_name
43
+ File.join(output_file_directory, base_output_file_name)
44
+ end
45
+
46
+ def read_interaction
47
+ self.class.read_interaction(group_metadata)
48
+ end
49
+
50
+ def profile_identifier
51
+ Naming.snake_case_for_profile(group_metadata)
52
+ end
53
+
54
+ def test_id
55
+ "ipa_010_#{profile_identifier}_read_test"
56
+ end
57
+
58
+ def class_name
59
+ "#{Naming.upper_camel_case_for_profile(group_metadata)}ReadTest"
60
+ end
61
+
62
+ def resource_type
63
+ group_metadata.resource
64
+ end
65
+
66
+ def resource_collection_string
67
+ if group_metadata.delayed? && resource_type != 'Provenance'
68
+ "scratch.dig(:references, '#{resource_type}')"
69
+ else
70
+ 'all_scratch_resources'
71
+ end
72
+ end
73
+
74
+ def conformance_expectation
75
+ read_interaction[:expectation]
76
+ end
77
+
78
+ def generate
79
+ FileUtils.mkdir_p(output_file_directory)
80
+ File.open(output_file_name, 'w') { |f| f.write(output) }
81
+
82
+ group_metadata.add_test(
83
+ id: test_id,
84
+ file_name: base_output_file_name
85
+ )
86
+ end
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,72 @@
1
+ require_relative 'naming'
2
+ require_relative 'special_cases'
3
+
4
+ module IpaTestKit
5
+ class Generator
6
+ class ReferenceResolutionTestGenerator
7
+ class << self
8
+ def generate(ig_metadata)
9
+ ig_metadata.groups
10
+ .reject { |group| SpecialCases.exclude_resource? group.resource }
11
+ .each { |group| new(group).generate }
12
+ end
13
+ end
14
+
15
+ attr_accessor :group_metadata
16
+
17
+ def initialize(group_metadata)
18
+ self.group_metadata = group_metadata
19
+ end
20
+
21
+ def template
22
+ @template ||= File.read(File.join(__dir__, 'templates', 'reference_resolution.rb.erb'))
23
+ end
24
+
25
+ def output
26
+ @output ||= ERB.new(template).result(binding)
27
+ end
28
+
29
+ def base_output_file_name
30
+ "#{class_name.underscore}.rb"
31
+ end
32
+
33
+ def output_file_directory
34
+ File.join(__dir__, '..', 'generated', profile_identifier)
35
+ end
36
+
37
+ def output_file_name
38
+ File.join(output_file_directory, base_output_file_name)
39
+ end
40
+
41
+ def profile_identifier
42
+ Naming.snake_case_for_profile(group_metadata)
43
+ end
44
+
45
+ def test_id
46
+ "ipa_010_#{profile_identifier}_reference_resolution_test"
47
+ end
48
+
49
+ def class_name
50
+ "#{Naming.upper_camel_case_for_profile(group_metadata)}ReferenceResolutionTest"
51
+ end
52
+
53
+ def resource_type
54
+ group_metadata.resource
55
+ end
56
+
57
+ def resource_collection_string
58
+ 'scratch_resources[:all]'
59
+ end
60
+
61
+ def generate
62
+ FileUtils.mkdir_p(output_file_directory)
63
+ File.open(output_file_name, 'w') { |f| f.write(output) }
64
+
65
+ group_metadata.add_test(
66
+ id: test_id,
67
+ file_name: base_output_file_name
68
+ )
69
+ end
70
+ end
71
+ end
72
+ end