Sha256: 2149560bc72c05ebd32a98f7d38eb20eff6d6b85596402445950a512255cef8a
Contents?: true
Size: 1.02 KB
Versions: 4
Compression:
Stored size: 1.02 KB
Contents
# encoding: UTF-8 require 'yaml' require 'spec_helper' 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) 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 describe 'ruby rule lists' do 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| samples.each do |sample| it "#{name} #{sample}" do expect(rule_proc.call(sample, RubyRuntime)).to eq(name) end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
cldr-plurals-1.1.1 | spec/ruby_sample_spec.rb |
cldr-plurals-1.1.0 | spec/ruby_sample_spec.rb |
cldr-plurals-1.0.1 | spec/ruby_sample_spec.rb |
cldr-plurals-1.0.0 | spec/ruby_sample_spec.rb |