Class: Polytrix::Validation

Inherits:
ManifestSection show all
Defined in:
lib/polytrix/validation.rb

Constant Summary collapse

ALLOWABLE_STATES =

TODO: Should we have (expectation) ‘failed’ vs (unexpected) ‘error’?

%w(passed pending failed skipped)

Instance Method Summary collapse

Methods inherited from Dash

#initialize

Constructor Details

This class inherits a constructor from Polytrix::Dash

Instance Method Details

#error_sourceObject

Gets the source of the validation code block where a ValidationFailure occurred.



24
25
26
27
# File 'lib/polytrix/validation.rb', line 24

def error_source
  return nil if error.nil?
  source_from_error(error)
end

#result=(state) ⇒ Object



11
12
13
14
15
# File 'lib/polytrix/validation.rb', line 11

def result=(state)
  state = state.to_s
  fail invalidate_state_error unless ALLOWABLE_STATES.include? state
  super
end