Class: Continuum::Assertion

Inherits:
Object
  • Object
show all
Defined in:
src/lib/continuum/assertion.rb

Overview

Encapsulates all of the data related to assertions returned from Access Engine

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(test_id, test_type, outcome, results) ⇒ Assertion

Returns a new instance of Assertion.

Parameters:

  • test_id (String)

    The id of the Access Engine test associated with this assertion.

  • test_type (String)

    The type of Access Engine test being run as part of this assertion.

  • outcome (String)

    The outcome of the assertion.

  • results (Array<TestResult>)

    The array of results for any elements which did not pass testing for the assertion.



36
37
38
39
40
41
# File 'src/lib/continuum/assertion.rb', line 36

def initialize(test_id, test_type, outcome, results)
    @test_id = test_id
    @test_type = test_type
    @outcome = outcome
    @results = results
end

Instance Attribute Details

#outcomeString

Gets the outcome of the assertion.

Returns:

  • (String)

    The outcome of the assertion.



25
26
27
# File 'src/lib/continuum/assertion.rb', line 25

def outcome
  @outcome
end

#resultsArray<TestResult>

Gets the array of results for any elements which did not pass testing for the assertion.

Returns:

  • (Array<TestResult>)

    The array of results for any elements which did not pass testing for the assertion.



30
31
32
# File 'src/lib/continuum/assertion.rb', line 30

def results
  @results
end

#test_idString

Gets the id of the Access Engine test associated with this assertion.

Returns:

  • (String)

    The id of the Access Engine test associated with this assertion.



15
16
17
# File 'src/lib/continuum/assertion.rb', line 15

def test_id
  @test_id
end

#test_typeString

Gets the type of Access Engine test being run as part of this assertion.

Returns:

  • (String)

    The type of Access Engine test being run as part of this assertion.



20
21
22
# File 'src/lib/continuum/assertion.rb', line 20

def test_type
  @test_type
end

Class Method Details

.from_json(json_data) ⇒ AccessibilityConcern

Parameters:

  • json_data (String, Hash)

Returns:



45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'src/lib/continuum/assertion.rb', line 45

def self.from_json(json_data)
    parsed = DataUtil.parse_json(json_data) || {}

    results = parsed['results'].map do|result|
        TestResult.from_json(result)
    end
    return new(
        parsed['testId'],
        parsed['testType'],
        parsed['outcome'],
        results
    )
end