Class: Dragnet::Verifiers::TestRecordVerifier

Inherits:
Verifier
  • Object
show all
Defined in:
lib/dragnet/verifiers/test_record_verifier.rb

Overview

Performs the verification process over a single TestRecord object.

Instance Attribute Summary collapse

Attributes inherited from Verifier

#test_record

Instance Method Summary collapse

Methods included from Helpers::RepositoryHelper

#relative_to_repo, #repo_base, #shorten_sha1

Constructor Details

#initialize(test_record:, repository:, test_records:) ⇒ TestRecordVerifier

Returns a new instance of TestRecordVerifier.

Parameters:

  • test_record (Dragnet::TestRecord)

    The TestRecord object to verify.

  • repository (Dragnet::BaseRepository)

    An object representing the repository the test record is referring to.

  • test_records (Array<Dragnet::TestRecord>)

    An array with all the TestRecord objects found in the Repository. These are needed when changes to the repository are being verified. Changes targeting the MTRs only are ignored by the verifiers.



23
24
25
26
27
# File 'lib/dragnet/verifiers/test_record_verifier.rb', line 23

def initialize(test_record:, repository:, test_records:)
  super(test_record: test_record)
  @repository = repository
  @test_records = test_records
end

Instance Attribute Details

#repositoryObject (readonly)

Returns the value of attribute repository.



13
14
15
# File 'lib/dragnet/verifiers/test_record_verifier.rb', line 13

def repository
  @repository
end

#test_recordsObject (readonly)

Returns the value of attribute test_records.



13
14
15
# File 'lib/dragnet/verifiers/test_record_verifier.rb', line 13

def test_records
  @test_records
end

Instance Method Details

#verifyDragnet::VerificationResult

Performs the verification and attaches the corresponding VerificationResult object to the TestRecord object.

Returns:



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/dragnet/verifiers/test_record_verifier.rb', line 33

def verify
  verification_result = verify_result

  verification_result ||= if test_record.files
                            verify_files
                          elsif test_record.repos
                            verify_repos
                          else
                            verify_changes
                          end

  verification_result || Dragnet::VerificationResult.new(status: :passed)
end