Class: Inferno::Entities::TestGroup

Inherits:
Object
  • Object
show all
Extended by:
Forwardable, DSL::FHIRClient::ClassMethods, DSL::HTTPClient::ClassMethods, DSL::Runnable
Includes:
DSL::FHIRValidation
Defined in:
lib/inferno/entities/test_group.rb

Instance Attribute Summary

Attributes included from DSL::Runnable

#parent, #suite_option_requirements

Class Method Summary collapse

Methods included from DSL::FHIRClient::ClassMethods

fhir_client

Methods included from DSL::HTTPClient::ClassMethods

http_client

Methods included from DSL::Runnable

description, id, input_instructions, inspect, optional, optional?, required, required?, required_suite_options, resume_test_route, route, short_description, short_title, title

Methods included from DSL::FHIRValidation

#find_validator, #resource_is_valid?

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/inferno/entities/test_group.rb', line 17

def method_missing(name, *args, &)
  parent_instance = self.class.parent&.new
  if parent_instance.respond_to?(name)
    parent_instance.send(name, *args, &)
  else
    super
  end
end

Class Method Details

.groupObject

Add a child group



57
58
59
60
# File 'lib/inferno/entities/test_group.rb', line 57

def group(...)
  ()
  define_child(...)
end

.groups(options = nil) ⇒ Array<Inferno::Entities::TestGroup>

Get this group’s child groups, filtered by suite options, if provided.

Parameters:

Returns:



41
42
43
# File 'lib/inferno/entities/test_group.rb', line 41

def groups(options = nil)
  children(options).select { |child| child < Inferno::Entities::TestGroup }
end

.repositoryObject



32
33
34
# File 'lib/inferno/entities/test_group.rb', line 32

def repository
  Inferno::Repositories::TestGroups.new
end

.run_as_group(value = true) ⇒ Object

When true, this group’s children can not be run individually in the UI, and this group must be run as a group.

Parameters:

  • value (Boolean) (defaults to: true)


112
113
114
# File 'lib/inferno/entities/test_group.rb', line 112

def run_as_group(value = true) # rubocop:disable Style/OptionalBooleanParameter
  @run_as_group = value
end

.run_as_group?Boolean

Returns:

  • (Boolean)


117
118
119
# File 'lib/inferno/entities/test_group.rb', line 117

def run_as_group?
  @run_as_group || false
end

.short_idString

Returns A short numeric id which is displayed in the UI.

Returns:

  • (String)

    A short numeric id which is displayed in the UI



85
86
87
88
89
90
91
# File 'lib/inferno/entities/test_group.rb', line 85

def short_id
  @short_id ||= begin
    prefix = parent.respond_to?(:short_id) ? "#{parent.short_id}." : ''
    suffix = parent ? (parent.groups.find_index(self) + 1).to_s : 'X'
    "#{prefix}#{suffix}"
  end
end

.testObject

Add a test



63
64
65
66
# File 'lib/inferno/entities/test_group.rb', line 63

def test(...)
  ()
  define_child(...)
end

.tests(options = nil) ⇒ Array<Inferno::Entities::Test>

Get this group’s child tests, filtered by suite options, if provided.

Parameters:

Returns:



50
51
52
# File 'lib/inferno/entities/test_group.rb', line 50

def tests(options = nil)
  children(options).select { |child| child < Inferno::Entities::Test }
end