]> git.openstreetmap.org Git - rails.git/blob - vendor/plugins/i18n_data/spec/i18n_data/live_data_provider_spec.rb
6c902fec56dcc5ca73397848db3f97edcd62a0ba
[rails.git] / vendor / plugins / i18n_data / spec / i18n_data / live_data_provider_spec.rb
1 require File.join(File.dirname(__FILE__),'..',"spec_helper")
2 require 'i18n_data/live_data_provider'
3
4 describe I18nData::LiveDataProvider do
5   describe :po_to_hash do
6     def po_to_hash(text)
7       I18nData::LiveDataProvider.send(:po_to_hash,text)
8     end
9     it "parses po file into translations" do
10       text = <<EOF
11 # come comment msgstr
12 msgid "one"
13 msgstr "1"
14 EOF
15       po_to_hash(text).should == {"one"=>"1"}
16     end
17     it "keeps order of translations" do
18       text = <<EOF
19 msgid "one"
20 msgstr "1"
21 msgid "two"
22 msgstr ""
23 msgid "three"
24 msgstr "3"
25 EOF
26       po_to_hash(text).should == {"one"=>"1","two"=>"","three"=>"3"}
27     end
28     pending_it "finds x-line long translations" do
29       text = <<EOF
30 #. name for chu, cu
31 msgid ""
32 "Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church "
33 "Slavonic"
34 msgstr "Kirchenslavisch"
35 EOF
36       long_name = "Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic"
37       po_to_hash(text)[long_name].should == "Kirchenslavisch"
38     end
39   end
40 end