Validate period for invalid values, refactor optional attribute validator, tests #2763

This commit is contained in:
Martin Lensment 2015-07-16 17:19:16 +03:00
parent 92e25cb61e
commit 7a8c7dd39e
4 changed files with 83 additions and 6 deletions

View file

@ -217,11 +217,11 @@ class EppController < ApplicationController
end
def optional_attribute(element_selector, attribute_selector, options)
element = requires(element_selector, allow_blank: options[:allow_blank])
full_selector = [@prefix, element_selector].compact.join(' ')
element = params[:parsed_frame].css(full_selector).first
return unless element
attribute = element[attribute_selector]
return if (attribute && options[:values].include?(attribute)) || !attribute
epp_errors << {