Module: AUPSTestKit::BasicTestCustodianResource

Included in:
BasicTestCustodianModule
Defined in:
lib/au_ps_inferno/utils/custodian/basic_test_custodian_resource.rb

Overview

Resolves Composition.custodian reference from the scratch bundle.

Instance Method Summary collapse

Instance Method Details

#custodian_resourceObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/au_ps_inferno/utils/custodian/basic_test_custodian_resource.rb', line 8

def custodian_resource
  return nil unless scratch_bundle.present?

  bundle_resource = BundleDecorator.new(scratch_bundle)
  composition_resource = bundle_resource.composition_resource
  return nil unless composition_resource.present?

  custodian_ref = first_composition_custodian_reference(composition_resource)
  return nil unless custodian_ref.present?

  ref_str = custodian_ref.respond_to?(:reference) ? custodian_ref.reference : custodian_ref['reference']
  return nil if ref_str.blank?

  bundle_resource.resource_by_reference(ref_str)
end