X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/8f7ecf169a3f15e125ffce2f1da219a4ef878f16..dd12e1de637d5242c8ac7ed933fd8a3f70a70367:/test/unit/i18n_test.rb 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