X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/e660e609661edadc1ed5ad49d6e83e936b2f91cd..4729163aa8e9bf6a7c9f12a8fcd77e6b632e9d80:/test/unit/i18n_test.rb?ds=inline diff --git a/test/unit/i18n_test.rb b/test/unit/i18n_test.rb index 73f893455..2fb13824c 100644 --- a/test/unit/i18n_test.rb +++ b/test/unit/i18n_test.rb @@ -24,14 +24,20 @@ class I18nTest < ActiveSupport::TestCase end end + if key =~ /^(active(model|record)\.)?errors\./ + variables.push("attribute") + end + value = I18n.t(key, :locale => locale, :fallback => true) if value.is_a?(Hash) value.each do |subkey,subvalue| # assert plural_keys.include?(subkey), "#{key}.#{subkey} is not a valid plural key" - subvalue.scan(/%\{(\w+)\}/) do - assert variables.include?($1), "#{key}.#{subkey} uses unknown interpolation variable #{$1}" + unless subvalue.nil? + subvalue.scan(/%\{(\w+)\}/) do + assert variables.include?($1), "#{key}.#{subkey} uses unknown interpolation variable #{$1}" + end end end else