amatsuda-i18n_generators 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/spec/cldr_spec.rb ADDED
@@ -0,0 +1,52 @@
1
+ $KCODE = 'U'
2
+
3
+ require File.join(File.dirname(__FILE__), '../generators/i18n_locales/lib/cldr')
4
+ include I18nLocalesGeneratorModule
5
+
6
+ describe CldrDocument do
7
+ before do
8
+ OpenURI.stub!(:open_uri).and_return(File.open(File.join(File.dirname(__FILE__), 'data/cldr/ja.html')))
9
+ @cldr = CldrDocument.new 'ja-JP'
10
+ end
11
+
12
+ it 'fetches date/formats/default value' do
13
+ @cldr.lookup('date/formats/default').should == '%Y/%m/%d'
14
+ end
15
+
16
+ it 'fetches date/formats/short value' do
17
+ @cldr.lookup('date/formats/short').should == '%y/%m/%d'
18
+ end
19
+
20
+ it 'fetches date/formats/long value' do
21
+ @cldr.lookup('date/formats/long').should == '%Y年%m月%d日%A'
22
+ end
23
+
24
+ it 'fetches date/day_names value' do
25
+ @cldr.lookup('date/day_names').should == ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日']
26
+ end
27
+
28
+ it 'fetches date/abbr_day_names value' do
29
+ @cldr.lookup('date/abbr_day_names').should == ['日', '月', '火', '水', '木', '金', '土']
30
+ end
31
+
32
+ it 'fetches time/formats/default value' do
33
+ @cldr.lookup('time/formats/default').should == '%Y/%m/%d %H:%M:%S'
34
+ end
35
+
36
+ it 'fetches time/formats/short value' do
37
+ @cldr.lookup('time/formats/short').should == '%y/%m/%d %H:%M'
38
+ end
39
+
40
+ it 'fetches time/formats/long value' do
41
+ @cldr.lookup('time/formats/long').should == '%Y年%m月%d日%A %H時%M分%S秒%Z'
42
+ end
43
+
44
+ it 'fetches time/am value' do
45
+ @cldr.lookup('time/am').should == '午前'
46
+ end
47
+
48
+ it 'fetches time/pm value' do
49
+ @cldr.lookup('time/pm').should == '午後'
50
+ end
51
+ end
52
+