spec/spec_helper.rb in cldr-plurals-1.0.1 vs spec/spec_helper.rb in cldr-plurals-1.1.0
- old
+ new
@@ -9,11 +9,11 @@
end
def each_rule
samples.each_pair do |locales, rules|
rules.each do |rule|
- next if rule[:text].empty? # @TODO handle this case
+ next if rule[:text].empty? # skip other rule test, as it's a fallback
tokens = CldrPlurals::Compiler::Tokenizer.tokenize(rule[:text])
rule_ast = CldrPlurals::Compiler::Parser.new(tokens).parse
yield locales, rule_ast, rule[:samples]
end
end
@@ -23,12 +23,11 @@
samples.each_pair do |locales, rules|
rule_list = CldrPlurals::Compiler::RuleList.new(locales)
samples = {}
rules.each do |rule|
- next if rule[:text].empty? # @TODO: handle this case
- rule_list.add_rule(rule[:name], rule[:text])
samples[rule[:name]] = rule[:samples]
+ rule_list.add_rule(rule[:name], rule[:text]) unless rule[:text].empty?
end
samples_per_name = samples.each_with_object({}) do |(name, samples), ret|
ret[name] = samples.flat_map do |sample_info|
sample_info[:samples]