Method: Bumbleworks::ProcessDefinition#validate!
- Defined in:
- lib/bumbleworks/process_definition.rb
#validate! ⇒ Object
Validates the ProcessDefinition by checking existence and uniqueness of name, existence of one of definition or tree, and validity of definition. Raises a Bumbleworks::ProcessDefinition::Invalid exception if errors are found, otherwise returns true
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/bumbleworks/process_definition.rb', line 30 def validate! errors = [] errors << "Name must be specified" unless @name errors << "Definition or tree must be specified" unless @definition || @tree begin build_tree! rescue Invalid errors << "Definition is not a valid process definition" end raise Invalid, "Validation failed: #{errors.join(', ')}" unless errors.empty? true end |