Class: Axe::API::Audit

Inherits:
Object
  • Object
show all
Defined in:
lib/axe/api/audit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(invocation, results) ⇒ Audit

Returns a new instance of Audit.



6
7
8
9
# File 'lib/axe/api/audit.rb', line 6

def initialize(invocation, results)
  @invocation = invocation
  @results = results
end

Instance Attribute Details

#invocationObject (readonly)

Returns the value of attribute invocation.



4
5
6
# File 'lib/axe/api/audit.rb', line 4

def invocation
  @invocation
end

#resultsObject (readonly)

Returns the value of attribute results.



4
5
6
# File 'lib/axe/api/audit.rb', line 4

def results
  @results
end

Instance Method Details

#failure_messageObject



15
16
17
# File 'lib/axe/api/audit.rb', line 15

def failure_message
  "#{results.failure_message}\nInvocation: #{invocation}"
end

#failure_message_when_negatedObject



19
20
21
# File 'lib/axe/api/audit.rb', line 19

def failure_message_when_negated
  "Expected to find accessibility violations. None were detected.\n\nInvocation: #{invocation}"
end

#passed?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/axe/api/audit.rb', line 11

def passed?
  results.violations.count == 0
end