spec/ruby_sample_spec.rb in cldr-plurals-1.1.1 vs spec/ruby_sample_spec.rb in cldr-plurals-1.2.0

- old
+ new

@@ -5,29 +5,31 @@ require 'cldr-plurals/ruby_runtime' include CldrPlurals include CldrPlurals::Compiler -describe 'ruby rules' do - each_rule do |locales, rule, samples| - ruby_code = RubyEmitter.emit_rule_standalone(rule) - rule_proc = eval(ruby_code) +describe 'ruby rules;' do + Samples.each_rule do |locales, rule, samples| + context "locales: #{locales}, rule: #{rule.name};" do + ruby_code = RubyEmitter.emit_rule_standalone(rule) + rule_proc = eval(ruby_code) - samples.each do |sample_info| - context "#{sample_info[:type]} samples" do - sample_info[:samples].each do |sample| - it sample do - args = RubyRuntime.build_args_for(sample) - expect(rule_proc.call(*args)).to eq(true) + samples.each do |sample_info| + context "#{sample_info[:type]} samples" do + sample_info[:samples].each do |sample| + it sample do + args = RubyRuntime.build_args_for(sample) + expect(rule_proc.call(*args)).to eq(true) + end end end end end end end describe 'ruby rule lists' do - each_rule_list do |rule_list, samples_per_name| + Samples.each_rule_list do |rule_list, samples_per_name| context rule_list.locale do ruby_code = rule_list.to_code(:ruby) rule_proc = eval(ruby_code) samples_per_name.each_pair do |name, samples|