Sha256: 8a633132401474c9caee0b219bc3c9eae028bff6548e89b2072ccf6960efd981

Contents?: true

Size: 1.74 KB

Versions: 12

Compression:

Stored size: 1.74 KB

Contents

require_relative 'test_group'
require_relative '../dsl/runnable'
require_relative '../repositories/test_groups'
require_relative '../repositories/test_suites'

module Inferno
  module Entities
    # A `TestSuite` represents a packaged group of tests, usually for a
    # single Implementation Guide
    class TestSuite
      extend DSL::Runnable
      extend DSL::FHIRClient::ClassMethods
      extend DSL::HTTPClient::ClassMethods
      include DSL::FHIRValidation

      class << self
        extend Forwardable

        def_delegator :default_group, :test

        def default_group
          return @default_group if @default_group

          @default_group = Class.new(TestGroup)
          groups << @default_group
          @default_group
        end

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

        def groups
          @groups ||= []
        end

        # Methods to configure Inferno::DSL::Runnable

        def group(...)
          child_metadata(group_metadata)
          define_child(...)
        end

        def group_metadata
          {
            class: TestGroup,
            repo: Inferno::Repositories::TestGroups.new,
            collection: groups
          }
        end

        def reference_hash
          {
            test_suite_id: id
          }
        end

        def find_validator(validator_name)
          validator = fhir_validators[validator_name]

          return validator if validator

          raise Exceptions::ValidatorNotFoundException, validator_name unless validator_name == :default

          fhir_validators[:default] =
            Inferno::DSL::FHIRValidation::Validator.new { |v| v.url default_validator_url }
        end
      end
    end
  end

  TestSuite = Entities::TestSuite
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
inferno_core-0.1.0 lib/inferno/entities/test_suite.rb
inferno_core-0.1.0.pre lib/inferno/entities/test_suite.rb
inferno_core-0.0.8 lib/inferno/entities/test_suite.rb
inferno_core-0.0.8.pre2 lib/inferno/entities/test_suite.rb
inferno_core-0.0.8.pre lib/inferno/entities/test_suite.rb
inferno_core-0.0.7 lib/inferno/entities/test_suite.rb
inferno_core-0.0.6 lib/inferno/entities/test_suite.rb
inferno_core-0.0.5 lib/inferno/entities/test_suite.rb
inferno_core-0.0.4 lib/inferno/entities/test_suite.rb
inferno_core-0.0.3 lib/inferno/entities/test_suite.rb
inferno_core-0.0.2 lib/inferno/entities/test_suite.rb
inferno_core-0.0.1 lib/inferno/entities/test_suite.rb