inferno_core 0.1.0 → 0.1.1.pre

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.
@@ -54,7 +54,7 @@ module Inferno
54
54
  return nil if params[:value].blank?
55
55
 
56
56
  case params[:type]&.to_s
57
- when 'text', 'textarea'
57
+ when 'text', 'textarea', 'radio'
58
58
  params[:value].to_s
59
59
  when 'oauth_credentials'
60
60
  credentials =
@@ -0,0 +1,40 @@
1
+ module Inferno
2
+ # @private
3
+ # This class takes an array of results and determines the overall result. This
4
+ # is used to determine the result of a TestGroup/TestSuite based on the
5
+ # results of it's children.
6
+ class ResultSummarizer
7
+ attr_reader :results
8
+
9
+ def initialize(results)
10
+ @results = results
11
+ end
12
+
13
+ def summarize
14
+ prioritized_result_strings.find { |result_string| unique_result_strings.include? result_string }
15
+ end
16
+
17
+ private
18
+
19
+ def prioritized_result_strings
20
+ Entities::Result::RESULT_OPTIONS
21
+ end
22
+
23
+ def required_results
24
+ @required_results ||= results.select(&:required?)
25
+ end
26
+
27
+ def all_optional_results?
28
+ required_results.blank?
29
+ end
30
+
31
+ def results_for_summary
32
+ all_optional_results? ? results : required_results
33
+ end
34
+
35
+ def unique_result_strings
36
+ @unique_result_strings ||=
37
+ results_for_summary.map(&:result).uniq
38
+ end
39
+ end
40
+ end
@@ -1,3 +1,4 @@
1
+ require_relative './result_summarizer'
1
2
  require_relative './utils/markdown_formatter'
2
3
 
3
4
  module Inferno
@@ -120,7 +121,9 @@ module Inferno
120
121
 
121
122
  children = parent.children
122
123
  child_results = results_repo.current_results_for_test_session_and_runnables(test_session.id, children)
123
- return if children.length != child_results.length
124
+ required_children = children.select(&:required?)
125
+ required_results = child_results.select(&:required?)
126
+ return if required_children.length != required_results.length
124
127
 
125
128
  old_result = results_repo.current_result_for_test_session(test_session.id, parent.reference_hash)&.result
126
129
  new_result = roll_up_result(child_results)
@@ -170,11 +173,7 @@ module Inferno
170
173
  end
171
174
 
172
175
  def roll_up_result(results)
173
- result_priority = Entities::Result::RESULT_OPTIONS
174
- unique_results = results.map(&:result).uniq
175
- result_priority.find do |result|
176
- unique_results.include? result
177
- end
176
+ ResultSummarizer.new(results).summarize
178
177
  end
179
178
  end
180
179
  end
@@ -1,3 +1,3 @@
1
1
  module Inferno
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1.pre'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inferno_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen MacVicar
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-01-10 00:00:00.000000000 Z
13
+ date: 2022-01-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -520,6 +520,7 @@ files:
520
520
  - lib/inferno/entities.rb
521
521
  - lib/inferno/entities/attributes.rb
522
522
  - lib/inferno/entities/entity.rb
523
+ - lib/inferno/entities/has_runnable.rb
523
524
  - lib/inferno/entities/header.rb
524
525
  - lib/inferno/entities/message.rb
525
526
  - lib/inferno/entities/request.rb
@@ -557,6 +558,7 @@ files:
557
558
  - lib/inferno/repositories/test_suites.rb
558
559
  - lib/inferno/repositories/tests.rb
559
560
  - lib/inferno/repositories/validate_runnable_reference.rb
561
+ - lib/inferno/result_summarizer.rb
560
562
  - lib/inferno/spec_support.rb
561
563
  - lib/inferno/test_runner.rb
562
564
  - lib/inferno/utils/markdown_formatter.rb
@@ -591,9 +593,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
591
593
  version: 2.7.0
592
594
  required_rubygems_version: !ruby/object:Gem::Requirement
593
595
  requirements:
594
- - - ">="
596
+ - - ">"
595
597
  - !ruby/object:Gem::Version
596
- version: '0'
598
+ version: 1.3.1
597
599
  requirements: []
598
600
  rubygems_version: 3.1.6
599
601
  signing_key: