lib/howitzer/web/page_validator.rb in howitzer-2.1.1 vs lib/howitzer/web/page_validator.rb in howitzer-2.2.0
- old
+ new
@@ -19,10 +19,11 @@
# Checks if any validations are defined for the page
# @raise [Howitzer::NoValidationError] if no one validation is defined for the page
def check_validations_are_defined!
return if self.class.validations.present?
+
raise Howitzer::NoValidationError, "No any page validation was found for '#{self.class.name}' page"
end
# This module holds page validation class methods
module ClassMethods
@@ -58,9 +59,10 @@
# @return [Boolean]
# @raise [Howitzer::NoValidationError] if no one validation is defined for the page
def opened?(sync: true)
return validations.all? { |(_, validation)| validation.call(self, sync) } if validations.present?
+
raise Howitzer::NoValidationError, "No any page validation was found for '#{name}' page"
end
# Finds all matched pages which satisfy of defined validations on current page
# @return [Array] page name list