mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 01:47:18 +02:00
Validate period for invalid values, refactor optional attribute validator, tests #2763
This commit is contained in:
parent
92e25cb61e
commit
7a8c7dd39e
4 changed files with 83 additions and 6 deletions
|
@ -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 << {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue