spec/i18n_tasks_spec.rb in i18n-tasks-0.0.7 vs spec/i18n_tasks_spec.rb in i18n-tasks-0.0.8
- old
+ new
@@ -21,10 +21,11 @@
TestCodebase.in_test_app_dir { YAML.load_file('config/locales/es.yml')['es']['missing_in_es']['a'].should == 'EN_TEXT' }
end
end
# --- setup ---
+ BENCH_KEYS = 3000
before do
gen_data = ->(v) {
{
'ca' => {'a' => v, 'b' => v, 'c' => v, 'd' => v, 'e' => "#{v}%{i}", 'f' => "#{v}%{i}"},
'cb' => {'a' => v, 'b' => "#{v}%{i}"},
@@ -33,10 +34,14 @@
'unused' => {'a' => v},
'missing_in_es' => {'a' => v},
'same_in_es' => {'a' => v},
'blank_in_es' => {'a' => v},
'relative' => {'index' => {'title' => v}}
+
+ }.tap {|r|
+ gen = r["bench"] = {}
+ BENCH_KEYS.times.map { |i| gen["key#{i}"] = v }
}
}
en_data = gen_data.('EN_TEXT')
es_data = gen_data.('ES_TEXT').except('missing_in_es')
@@ -70,9 +75,11 @@
I18n.t("hash_pattern.\#{some_value}", i: "Hello")
I18n.t("hash_pattern2." + some_value, i: "Hello")
end
end
RUBY
+ # test that our algorithms can scale to the order of {BENCH_KEYS} keys.
+ 'app/heavy.file' => BENCH_KEYS.times.map { |i| "t('bench.key#{i}') " }.join
}
TestCodebase.setup fs
end
after do