Class: USCoreTestKit::Client::Generator::GroupGenerator
Instance Attribute Summary
#base_output_dir, #group_metadata
Instance Method Summary
collapse
#add_special_tests, #base_metadata_file_name, #base_output_file_name, generate, #initialize, #metadata_file_name, #optional?, #output_file_name, #profile_identifier, #profile_name, #profile_url, #required_searches, #resource_type, #search_description, #search_param_name_string, #search_validation_resource_type, #short_description, #test_file_list, #test_id_list, #title
Instance Method Details
#class_name ⇒ Object
19
20
21
|
# File 'lib/us_core_test_kit/client/generator/group_generator.rb', line 19
def class_name
"#{profile_identifier.camelize}ClientGroup"
end
|
78
79
80
|
# File 'lib/us_core_test_kit/client/generator/group_generator.rb', line 78
def conformance_optional?
group_metadata.resource_conformance_expectation != 'SHALL'
end
|
#description ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/us_core_test_kit/client/generator/group_generator.rb', line 31
def description
<<~DESCRIPTION
# Background
This test group verifies that the client can access #{resource_type} data
conforming to the #{profile_name}.
# Testing Methodology
## Data Access Supported
Clients may not be required to support the #{resource_type} FHIR resource type. However, if they
do support it, they must support the #{profile_name} and the resource type's search parameters.
The tests in this group will not execute if client makes no attempt to access data for the
#{resource_type} resource type. In this case, the test will be marked as skip if support
for the resource type is required, and omitted otherwise.
## Reading
This test will check that the client performed a read of the following id:
* `us-core-client-tests-#{profile_identifier.underscore.dasherize}`
## Searching
These tests will check that the client performed searches agains the
#{resource_type} resource type with the following required parameters:
#{search_param_name_string}
Inferno will also look for searches using the following optional parameters:
#{optional_search_param_name_string}
DESCRIPTION
end
|
#generate ⇒ Object
82
83
84
85
86
|
# File 'lib/us_core_test_kit/client/generator/group_generator.rb', line 82
def generate
File.write(output_file_name, output)
group_metadata.id = group_id
group_metadata.file_name = base_output_file_name
end
|
#group_id ⇒ Object
27
28
29
|
# File 'lib/us_core_test_kit/client/generator/group_generator.rb', line 27
def group_id
"us_core_client_#{group_metadata.reformatted_version}_#{profile_identifier}"
end
|
#module_name ⇒ Object
23
24
25
|
# File 'lib/us_core_test_kit/client/generator/group_generator.rb', line 23
def module_name
"USCoreClient#{group_metadata.reformatted_version.upcase}"
end
|
#optional_search_param_name_string ⇒ Object
71
72
73
74
75
76
|
# File 'lib/us_core_test_kit/client/generator/group_generator.rb', line 71
def optional_search_param_name_string
optional_searches
.map { |search| search[:names].join(' + ') }
.map { |names| "* #{names}" }
.join("\n")
end
|
#optional_searches ⇒ Object
67
68
69
|
# File 'lib/us_core_test_kit/client/generator/group_generator.rb', line 67
def optional_searches
group_metadata.searches.select { |search| search[:expectation] != 'SHALL' }
end
|
#output ⇒ Object
15
16
17
|
# File 'lib/us_core_test_kit/client/generator/group_generator.rb', line 15
def output
@output ||= ERB.new(template, trim_mode: '-').result(binding)
end
|
#template ⇒ Object
11
12
13
|
# File 'lib/us_core_test_kit/client/generator/group_generator.rb', line 11
def template
@template ||= File.read(File.join(__dir__, 'templates', 'group.rb.erb'))
end
|