inferno_core 0.5.4 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/inferno/apps/cli/execute/console_outputter.rb +2 -2
- data/lib/inferno/apps/cli/new.rb +8 -3
- data/lib/inferno/apps/cli/suites.rb +0 -2
- data/lib/inferno/apps/cli/templates/%library_name%.gemspec.tt +3 -14
- data/lib/inferno/apps/cli/templates/.rubocop.yml +77 -0
- data/lib/inferno/apps/cli/templates/.ruby-version +1 -1
- data/lib/inferno/apps/cli/templates/.tool-versions +1 -1
- data/lib/inferno/apps/cli/templates/Dockerfile.tt +2 -1
- data/lib/inferno/apps/cli/templates/Gemfile.tt +7 -0
- data/lib/inferno/apps/cli/templates/lib/%library_name%/suite.rb.tt +1 -1
- data/lib/inferno/config/boot/suites.rb +1 -0
- data/lib/inferno/dsl/fhir_resource_validation.rb +7 -5
- data/lib/inferno/dsl/fhir_validation.rb +13 -7
- data/lib/inferno/dsl/suite_endpoint.rb +1 -1
- data/lib/inferno/public/bundle.js +17 -17
- data/lib/inferno/route_storage.rb +10 -0
- data/lib/inferno/spec_support.rb +2 -0
- data/lib/inferno/version.rb +1 -1
- data/lib/inferno.rb +1 -3
- data/spec/shared/test_kit_examples.rb +133 -0
- metadata +21 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 511a1a15fdcb49bcf9a58821b087d8a42394085f6c735971857a2e45710b7269
|
4
|
+
data.tar.gz: 2635bf69d9662b8afbaea341348d8dbc446707c6804be1f491c555376b8e31a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a31b3fe1f72ff67cc2be3c8ff11d7dfd7f6c7c203e84c55b2072f205343c6c522686accc2b927088d31ade270fa127d8ad741fbced1827497f4a3d8102d9df3
|
7
|
+
data.tar.gz: 1bc84724a28ae55cecc8550b51143f3c2f4ff414891c8241012ca1f94e7ea20915a801d3c3616b4ab5a4667caf12f42a273f589ad2537ab13faec9aa36144c7e
|
data/lib/inferno/apps/cli/new.rb
CHANGED
@@ -71,6 +71,7 @@ module Inferno
|
|
71
71
|
inside(root_name) do
|
72
72
|
bundle_install
|
73
73
|
inferno_migrate
|
74
|
+
initialize_git_repo
|
74
75
|
load_igs
|
75
76
|
end
|
76
77
|
|
@@ -85,7 +86,7 @@ module Inferno
|
|
85
86
|
private
|
86
87
|
|
87
88
|
def authors
|
88
|
-
options['author'].presence || [default_author]
|
89
|
+
(options['author'].presence || [default_author]).to_json.gsub('"', "'")
|
89
90
|
end
|
90
91
|
|
91
92
|
def default_author
|
@@ -106,6 +107,10 @@ module Inferno
|
|
106
107
|
run 'bundle exec inferno migrate', verbose: !options['quiet'], capture: options['quiet']
|
107
108
|
end
|
108
109
|
|
110
|
+
def initialize_git_repo
|
111
|
+
run 'git init -q && git add . && git commit -aqm "initial commit"'
|
112
|
+
end
|
113
|
+
|
109
114
|
def load_igs
|
110
115
|
config = { verbose: !options['quiet'] }
|
111
116
|
options['implementation_guide']&.each_with_index do |ig, idx|
|
@@ -119,8 +124,8 @@ module Inferno
|
|
119
124
|
end
|
120
125
|
end
|
121
126
|
|
122
|
-
def say_unless_quiet(*
|
123
|
-
say(*
|
127
|
+
def say_unless_quiet(*)
|
128
|
+
say(*) unless options['quiet']
|
124
129
|
end
|
125
130
|
end
|
126
131
|
end
|
@@ -5,29 +5,18 @@ Gem::Specification.new do |spec|
|
|
5
5
|
spec.version = <%= module_name %>::VERSION
|
6
6
|
spec.authors = <%= authors %>
|
7
7
|
# spec.email = ['TODO']
|
8
|
-
spec.date = Time.now.utc.strftime('%Y-%m-%d')
|
9
8
|
spec.summary = '<%= title_name %>'
|
10
9
|
# spec.description = <<~DESCRIPTION
|
11
10
|
# This is a big markdown description of the test kit.
|
12
11
|
# DESCRIPTION
|
13
12
|
# spec.homepage = 'TODO'
|
14
13
|
spec.license = 'Apache-2.0'
|
15
|
-
spec.
|
16
|
-
spec.
|
17
|
-
spec.add_development_dependency 'factory_bot', '~> 6.1'
|
18
|
-
spec.add_development_dependency 'rspec', '~> 3.10'
|
19
|
-
spec.add_development_dependency 'webmock', '~> 3.11'
|
20
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 3.1.2')
|
14
|
+
spec.add_dependency 'inferno_core', '~> <%= Inferno::VERSION %>'
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 3.3.6')
|
21
16
|
spec.metadata['inferno_test_kit'] = 'true'
|
22
17
|
# spec.metadata['homepage_uri'] = spec.homepage
|
23
18
|
# spec.metadata['source_code_uri'] = 'TODO'
|
24
|
-
spec.files
|
25
|
-
Dir['lib/**/*.rb'],
|
26
|
-
Dir['lib/**/*.json'],
|
27
|
-
Dir['config/presets/*.json'],
|
28
|
-
Dir['config/presets/*.json.erb'],
|
29
|
-
'LICENSE'
|
30
|
-
].flatten
|
19
|
+
spec.files = `[ -d .git ] && git ls-files -z lib config/presets LICENSE`.split("\x0")
|
31
20
|
|
32
21
|
spec.require_paths = ['lib']
|
33
22
|
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-rspec
|
3
|
+
|
4
|
+
AllCops:
|
5
|
+
NewCops: enable
|
6
|
+
SuggestExtensions: false
|
7
|
+
TargetRubyVersion: 3.3
|
8
|
+
Exclude:
|
9
|
+
- 'Gemfile'
|
10
|
+
- 'vendor/**/*'
|
11
|
+
|
12
|
+
Layout/LineLength:
|
13
|
+
Max: 120
|
14
|
+
|
15
|
+
Layout/MultilineMethodCallIndentation:
|
16
|
+
EnforcedStyle: 'indented'
|
17
|
+
|
18
|
+
Style/Documentation:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
Style/FrozenStringLiteralComment:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Style/NumericLiterals:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
Style/OpenStructUse:
|
28
|
+
Exclude:
|
29
|
+
- 'spec/**/*'
|
30
|
+
|
31
|
+
Style/SymbolArray:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
Style/WordArray:
|
35
|
+
Enabled: false
|
36
|
+
|
37
|
+
Metrics/AbcSize:
|
38
|
+
Enabled: false
|
39
|
+
|
40
|
+
Metrics/BlockLength:
|
41
|
+
Enabled: false
|
42
|
+
|
43
|
+
Metrics/ClassLength:
|
44
|
+
Enabled: false
|
45
|
+
|
46
|
+
Metrics/MethodLength:
|
47
|
+
Enabled: false
|
48
|
+
|
49
|
+
Metrics/ModuleLength:
|
50
|
+
Enabled: false
|
51
|
+
|
52
|
+
Metrics/PerceivedComplexity:
|
53
|
+
Enabled: false
|
54
|
+
|
55
|
+
Metrics/ParameterLists:
|
56
|
+
Enabled: false
|
57
|
+
|
58
|
+
RSpec/AnyInstance:
|
59
|
+
Enabled: false
|
60
|
+
|
61
|
+
RSpec/ExampleLength:
|
62
|
+
Enabled: false
|
63
|
+
|
64
|
+
RSpec/MultipleExpectations:
|
65
|
+
Enabled: false
|
66
|
+
|
67
|
+
RSpec/MultipleMemoizedHelpers:
|
68
|
+
Enabled: false
|
69
|
+
|
70
|
+
RSpec/NestedGroups:
|
71
|
+
Enabled: false
|
72
|
+
|
73
|
+
RSpec/NotToNot:
|
74
|
+
EnforcedStyle: to_not
|
75
|
+
|
76
|
+
Gemspec/RequireMFA:
|
77
|
+
Enabled: false
|
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.3.6
|
@@ -1 +1 @@
|
|
1
|
-
ruby 3.
|
1
|
+
ruby 3.3.6
|
@@ -1,4 +1,4 @@
|
|
1
|
-
FROM ruby:3.
|
1
|
+
FROM ruby:3.3.6
|
2
2
|
|
3
3
|
ENV INSTALL_PATH=/opt/inferno/
|
4
4
|
ENV APP_ENV=production
|
@@ -7,6 +7,7 @@ RUN mkdir -p $INSTALL_PATH
|
|
7
7
|
WORKDIR $INSTALL_PATH
|
8
8
|
|
9
9
|
ADD lib/<%= library_name %>/metadata.rb $INSTALL_PATH/lib/<%= library_name %>/metadata.rb
|
10
|
+
ADD lib/<%= library_name %>/version.rb $INSTALL_PATH/lib/<%= library_name %>/version.rb
|
10
11
|
ADD *.gemspec $INSTALL_PATH
|
11
12
|
ADD Gemfile* $INSTALL_PATH
|
12
13
|
RUN gem install bundler
|
@@ -6,8 +6,15 @@ gemspec
|
|
6
6
|
|
7
7
|
group :development, :test do
|
8
8
|
gem 'debug'
|
9
|
+
gem 'rubocop', '~> 1.9'
|
10
|
+
gem 'rubocop-rspec', require: false
|
9
11
|
end
|
10
12
|
|
11
13
|
group :test do
|
14
|
+
gem 'database_cleaner-sequel', '~> 1.8'
|
15
|
+
gem 'factory_bot', '~> 6.1'
|
12
16
|
gem 'rack-test'
|
17
|
+
gem 'rspec', '~> 3.10'
|
18
|
+
gem 'simplecov', '0.21.2', require: false
|
19
|
+
gem 'webmock', '~> 3.11'
|
13
20
|
end
|
@@ -6,6 +6,7 @@ Inferno::Application.register_provider(:suites) do
|
|
6
6
|
require 'inferno/entities/test_group'
|
7
7
|
require 'inferno/entities/test_suite'
|
8
8
|
require 'inferno/entities/test_kit'
|
9
|
+
require 'inferno/route_storage'
|
9
10
|
|
10
11
|
files_to_load = Dir.glob(File.join(Dir.pwd, 'lib', '*.rb'))
|
11
12
|
|
@@ -157,7 +157,7 @@ module Inferno
|
|
157
157
|
end
|
158
158
|
|
159
159
|
# @see Inferno::DSL::FHIRResourceValidation#resource_is_valid?
|
160
|
-
def resource_is_valid?(resource, profile_url, runnable)
|
160
|
+
def resource_is_valid?(resource, profile_url, runnable, add_messages_to_runnable: true) # rubocop:disable Metrics/CyclomaticComplexity
|
161
161
|
profile_url ||= FHIR::Definitions.resource_definition(resource.resourceType).url
|
162
162
|
|
163
163
|
begin
|
@@ -173,8 +173,10 @@ module Inferno
|
|
173
173
|
|
174
174
|
message_hashes = message_hashes_from_outcome(outcome, resource, profile_url)
|
175
175
|
|
176
|
-
|
177
|
-
|
176
|
+
if add_messages_to_runnable
|
177
|
+
message_hashes
|
178
|
+
.each { |message_hash| runnable.add_message(message_hash[:type], message_hash[:message]) }
|
179
|
+
end
|
178
180
|
|
179
181
|
unless response.status == 200
|
180
182
|
raise Inferno::Exceptions::ErrorInValidatorException,
|
@@ -380,10 +382,10 @@ module Inferno
|
|
380
382
|
# using multiple validators
|
381
383
|
# @param required_suite_options [Hash] suite options that must be
|
382
384
|
# selected in order to use this validator
|
383
|
-
def fhir_resource_validator(name = :default, required_suite_options: nil, &
|
385
|
+
def fhir_resource_validator(name = :default, required_suite_options: nil, &)
|
384
386
|
current_validators = fhir_validators[name] || []
|
385
387
|
|
386
|
-
new_validator = Inferno::DSL::FHIRResourceValidation::Validator.new(name, id, required_suite_options, &
|
388
|
+
new_validator = Inferno::DSL::FHIRResourceValidation::Validator.new(name, id, required_suite_options, &)
|
387
389
|
|
388
390
|
current_validators.reject! { |validator| validator.requirements == required_suite_options }
|
389
391
|
current_validators << new_validator
|
@@ -30,9 +30,13 @@ module Inferno
|
|
30
30
|
# @param resource [FHIR::Model]
|
31
31
|
# @param profile_url [String]
|
32
32
|
# @param validator [Symbol] the name of the validator to use
|
33
|
+
# @param add_messages_to_runnable [Boolean] whether to add validation messages to runnable or not
|
33
34
|
# @return [Boolean] whether the resource is valid
|
34
|
-
def resource_is_valid?(
|
35
|
-
|
35
|
+
def resource_is_valid?(
|
36
|
+
resource: self.resource, profile_url: nil,
|
37
|
+
validator: :default, add_messages_to_runnable: true
|
38
|
+
)
|
39
|
+
find_validator(validator).resource_is_valid?(resource, profile_url, self, add_messages_to_runnable:)
|
36
40
|
end
|
37
41
|
|
38
42
|
# Find a particular validator. Looks through a runnable's parents up to
|
@@ -113,7 +117,7 @@ module Inferno
|
|
113
117
|
end
|
114
118
|
|
115
119
|
# @see Inferno::DSL::FHIRValidation#resource_is_valid?
|
116
|
-
def resource_is_valid?(resource, profile_url, runnable)
|
120
|
+
def resource_is_valid?(resource, profile_url, runnable, add_messages_to_runnable: true) # rubocop:disable Metrics/CyclomaticComplexity
|
117
121
|
profile_url ||= FHIR::Definitions.resource_definition(resource.resourceType).url
|
118
122
|
|
119
123
|
begin
|
@@ -128,8 +132,10 @@ module Inferno
|
|
128
132
|
|
129
133
|
message_hashes = message_hashes_from_outcome(outcome, resource, profile_url)
|
130
134
|
|
131
|
-
|
132
|
-
|
135
|
+
if add_messages_to_runnable
|
136
|
+
message_hashes
|
137
|
+
.each { |message_hash| runnable.add_message(message_hash[:type], message_hash[:message]) }
|
138
|
+
end
|
133
139
|
|
134
140
|
unless response.status == 200
|
135
141
|
raise Inferno::Exceptions::ErrorInValidatorException,
|
@@ -254,10 +260,10 @@ module Inferno
|
|
254
260
|
# using multiple validators
|
255
261
|
# @param required_suite_options [Hash] suite options that must be
|
256
262
|
# selected in order to use this validator
|
257
|
-
def validator(name = :default, required_suite_options: nil, &
|
263
|
+
def validator(name = :default, required_suite_options: nil, &)
|
258
264
|
current_validators = fhir_validators[name] || []
|
259
265
|
|
260
|
-
new_validator = Inferno::DSL::FHIRValidation::Validator.new(required_suite_options, &
|
266
|
+
new_validator = Inferno::DSL::FHIRValidation::Validator.new(required_suite_options, &)
|
261
267
|
|
262
268
|
current_validators.reject! { |validator| validator.requirements == required_suite_options }
|
263
269
|
current_validators << new_validator
|
@@ -12,7 +12,7 @@ module Inferno
|
|
12
12
|
# class AuthorizedEndpoint < Inferno::DSL::SuiteEndpoint
|
13
13
|
# # Identify the incoming request based on a bearer token
|
14
14
|
# def test_run_identifier
|
15
|
-
# request.
|
15
|
+
# request.headers['authorization']&.delete_prefix('Bearer ')
|
16
16
|
# end
|
17
17
|
#
|
18
18
|
# # Return a json FHIR Patient resource
|