spec/time_spec.rb in ffi-icu-0.2.0 vs spec/time_spec.rb in ffi-icu-0.3.0

- old
+ new

@@ -1,9 +1,7 @@ # encoding: UTF-8 -require 'spec_helper' - module ICU describe TimeFormatting do describe 'the TimeFormatting ' do t0 = Time.at(1226499676) # in TZ=Europe/Prague Time.mktime(2008, 11, 12, 15, 21, 16) t1 = Time.at(1224890117) # in TZ=Europe/Prague Time.mktime(2008, 10, 25, 01, 15, 17) @@ -15,25 +13,25 @@ t7 = Time.at(1206758243) # in TZ=Europe/Prague Time.mktime(2008, 03, 29, 03, 37, 23) t8 = Time.at(1206761904) # in TZ=Europe/Prague Time.mktime(2008, 03, 29, 04, 38, 24) f1 = TimeFormatting.create(:locale => 'cs_CZ', :zone => 'Europe/Prague', :date => :long , :time => :long, :tz_style => :localized_long) it 'check date_format for lang=cs_CZ' do - f1.date_format(true).should eql "d. MMMM y H:mm:ss ZZZZ" - f1.date_format(false).should eql "d. MMMM y H:mm:ss ZZZZ" + expect(f1.date_format(true)).to eq("d. MMMM y H:mm:ss ZZZZ") + expect(f1.date_format(false)).to eq("d. MMMM y H:mm:ss ZZZZ") end it "for lang=cs_CZ zone=Europe/Prague" do - f1.should be_an_instance_of TimeFormatting::DateTimeFormatter - f1.format(t0).should eql "12. listopadu 2008 15:21:16 GMT+01:00" - f1.format(t1).should eql "25. října 2008 1:15:17 GMT+02:00" - f1.format(t2).should eql "25. října 2008 2:16:18 GMT+02:00" - f1.format(t3).should eql "25. října 2008 3:17:19 GMT+02:00" - f1.format(t4).should eql "25. října 2008 4:18:20 GMT+02:00" - f1.format(t5).should eql "29. března 2008 1:35:21 GMT+01:00" - f1.format(t6).should eql "29. března 2008 2:36:22 GMT+01:00" - f1.format(t7).should eql "29. března 2008 3:37:23 GMT+01:00" - f1.format(t8).should eql "29. března 2008 4:38:24 GMT+01:00" + expect(f1).to be_an_instance_of TimeFormatting::DateTimeFormatter + expect(f1.format(t0)).to eq("12. listopadu 2008 15:21:16 GMT+01:00") + expect(f1.format(t1)).to eq("25. října 2008 1:15:17 GMT+02:00") + expect(f1.format(t2)).to eq("25. října 2008 2:16:18 GMT+02:00") + expect(f1.format(t3)).to eq("25. října 2008 3:17:19 GMT+02:00") + expect(f1.format(t4)).to eq("25. října 2008 4:18:20 GMT+02:00") + expect(f1.format(t5)).to eq("29. března 2008 1:35:21 GMT+01:00") + expect(f1.format(t6)).to eq("29. března 2008 2:36:22 GMT+01:00") + expect(f1.format(t7)).to eq("29. března 2008 3:37:23 GMT+01:00") + expect(f1.format(t8)).to eq("29. března 2008 4:38:24 GMT+01:00") end f2 = TimeFormatting.create(:locale => 'en_US', :zone => 'Europe/Moscow', :date => :short , :time => :long, :tz_style => :generic_location) cldr_version = Lib.cldr_version.to_s en_tz = "Moscow Time" @@ -43,48 +41,47 @@ en_sep = "" end en_exp = "M/d/yy#{en_sep} h:mm:ss a VVVV" it 'check date_format for lang=en_US' do - f2.date_format(true).should eql en_exp - f2.date_format(false).should eql en_exp + expect(f2.date_format(true)).to eq(en_exp) + expect(f2.date_format(false)).to eq(en_exp) end it "lang=en_US zone=Europe/Moscow" do - f2.format(t0).should eql "11/12/08#{en_sep} 5:21:16 PM #{en_tz}" - f2.format(t1).should eql "10/25/08#{en_sep} 3:15:17 AM #{en_tz}" - f2.format(t2).should eql "10/25/08#{en_sep} 4:16:18 AM #{en_tz}" - f2.format(t3).should eql "10/25/08#{en_sep} 5:17:19 AM #{en_tz}" - f2.format(t4).should eql "10/25/08#{en_sep} 6:18:20 AM #{en_tz}" - f2.format(t5).should eql "3/29/08#{en_sep} 3:35:21 AM #{en_tz}" - f2.format(t6).should eql "3/29/08#{en_sep} 4:36:22 AM #{en_tz}" - f2.format(t7).should eql "3/29/08#{en_sep} 5:37:23 AM #{en_tz}" - f2.format(t8).should eql "3/29/08#{en_sep} 6:38:24 AM #{en_tz}" + expect(f2.format(t0)).to eq("11/12/08#{en_sep} 5:21:16 PM #{en_tz}") + expect(f2.format(t1)).to eq("10/25/08#{en_sep} 3:15:17 AM #{en_tz}") + expect(f2.format(t2)).to eq("10/25/08#{en_sep} 4:16:18 AM #{en_tz}") + expect(f2.format(t3)).to eq("10/25/08#{en_sep} 5:17:19 AM #{en_tz}") + expect(f2.format(t4)).to eq("10/25/08#{en_sep} 6:18:20 AM #{en_tz}") + expect(f2.format(t5)).to eq("3/29/08#{en_sep} 3:35:21 AM #{en_tz}") + expect(f2.format(t6)).to eq("3/29/08#{en_sep} 4:36:22 AM #{en_tz}") + expect(f2.format(t7)).to eq("3/29/08#{en_sep} 5:37:23 AM #{en_tz}") + expect(f2.format(t8)).to eq("3/29/08#{en_sep} 6:38:24 AM #{en_tz}") end f3 = TimeFormatting.create(:locale => 'de_DE', :zone => 'Africa/Dakar ', :date => :short , :time => :long) ge_sep = "" if cldr_version >= "27.0.1" ge_sep = "," end ge_exp = "dd.MM.yy#{ge_sep} HH:mm:ss z" it 'check date_format for lang=de_DE' do - f3.date_format(true).should eql ge_exp - f3.date_format(false).should eql ge_exp + expect(f3.date_format(true)).to eq(ge_exp) + expect(f3.date_format(false)).to eq(ge_exp) end it "lang=de_DE zone=Africa/Dakar" do - f3.format(t0).should eql "12.11.08#{ge_sep} 14:21:16 GMT" - f3.format(t1).should eql "24.10.08#{ge_sep} 23:15:17 GMT" - f3.format(t2).should eql "25.10.08#{ge_sep} 00:16:18 GMT" - f3.format(t3).should eql "25.10.08#{ge_sep} 01:17:19 GMT" - f3.format(t4).should eql "25.10.08#{ge_sep} 02:18:20 GMT" - f3.format(t5).should eql "29.03.08#{ge_sep} 00:35:21 GMT" - f3.format(t6).should eql "29.03.08#{ge_sep} 01:36:22 GMT" - f3.format(t7).should eql "29.03.08#{ge_sep} 02:37:23 GMT" - f3.format(t8).should eql "29.03.08#{ge_sep} 03:38:24 GMT" + expect(f3.format(t0)).to eq("12.11.08#{ge_sep} 14:21:16 GMT") + expect(f3.format(t1)).to eq("24.10.08#{ge_sep} 23:15:17 GMT") + expect(f3.format(t2)).to eq("25.10.08#{ge_sep} 00:16:18 GMT") + expect(f3.format(t3)).to eq("25.10.08#{ge_sep} 01:17:19 GMT") + expect(f3.format(t4)).to eq("25.10.08#{ge_sep} 02:18:20 GMT") + expect(f3.format(t5)).to eq("29.03.08#{ge_sep} 00:35:21 GMT") + expect(f3.format(t6)).to eq("29.03.08#{ge_sep} 01:36:22 GMT") + expect(f3.format(t7)).to eq("29.03.08#{ge_sep} 02:37:23 GMT") + expect(f3.format(t8)).to eq("29.03.08#{ge_sep} 03:38:24 GMT") end end end end -