lib/polish_invoicer/validator.rb in polish_invoicer-0.0.25 vs lib/polish_invoicer/validator.rb in polish_invoicer-0.0.26

- old
+ new

@@ -18,10 +18,11 @@ check_price_paid check_vat check_proforma check_create_and_payment_date check_currency + check_lang @errors.empty? end private @@ -120,9 +121,16 @@ def check_currency return if @errors[:currency] return if %w[PLN EUR USD GBP].include?(@invoice.currency) @errors[:currency] = 'Nieznana waluta' + end + + def check_lang + return if blank?(@invoice.lang) + return if %w[pl pl_en en].include?(@invoice.lang) + + @errors[:lang] = 'Nieznany język' end def blank?(value) value.to_s.strip == '' end