Class: ESS::Validation::CurrMandatoryIfValueGT0

Inherits:
Object
  • Object
show all
Defined in:
lib/ess/validation.rb

Instance Method Summary collapse

Instance Method Details

#validate(price_tag) ⇒ Object



616
617
618
619
620
621
622
# File 'lib/ess/validation.rb', line 616

def validate price_tag
  if price_tag.value.text!.to_i != 0
    if price_tag.currency.text! == ""
      raise ValidationError, "the <currency> element of a price item cannot be empty if <value> is not 0"
    end
  end
end