TimezoneParser 0.4.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,12 +2,6 @@
2
2
  require 'spec_helper'
3
3
 
4
4
  describe TimezoneParser do
5
- describe '.preload' do
6
- it 'should preload data files' do
7
- expect(TimezoneParser.preload).to be true
8
- end
9
- end
10
-
11
5
  describe '.isValid?' do
12
6
  it 'should be valid timezone abbreviation' do
13
7
  expect(TimezoneParser.isValid?('HAP')).to be true
@@ -29,6 +29,21 @@ describe TimezoneParser do
29
29
  it 'should return all offsets for "Ալյասկայի ամառային ժամանակ"' do
30
30
  expect(TimezoneParser::Timezone.new('Ալյասկայի ամառային ժամանակ').getOffsets).to eq([-28800])
31
31
  end
32
+
33
+ it 'should find offsets using time range' do
34
+ timezone = TimezoneParser::Timezone.new('җәйге Үзәк Европа вакыты')
35
+ timezone.FromTime = nil
36
+ timezone.ToTime = DateTime.parse('1990-05-03T22:00:00+00:00')
37
+ expect(timezone.getOffsets).to eq([0, 3600, 4772, 4800, 7200, 10800])
38
+
39
+ timezone.reset
40
+ timezone.FromTime = DateTime.parse('2013-10-26T00:00:00+00:00')
41
+ timezone.ToTime = nil
42
+ expect(timezone.getOffsets).to eq([7200])
43
+
44
+ timezone.reset
45
+ expect(timezone.setTime(DateTime.parse('2015-01-01T00:00:00+00:00'), DateTime.parse('1985-01-01T00:00:00+00:00')).getOffsets).to eq([3600, 7200])
46
+ end
32
47
  end
33
48
 
34
49
  describe '#getTimezones' do
@@ -47,6 +47,13 @@ describe TimezoneParser do
47
47
  end
48
48
  end
49
49
 
50
+ describe '#getTypes' do
51
+ it 'should return types for timezones' do
52
+ expect(TimezoneParser::WindowsZone.new('Arabský čas (normálny)').getTypes).to eq([:standard])
53
+ expect(TimezoneParser::WindowsZone.new('Azerbaijan Summer Time').getTypes).to eq([:daylight])
54
+ end
55
+ end
56
+
50
57
  describe '.isValid?' do
51
58
  it 'should be valid Windows zone' do
52
59
  expect(TimezoneParser::WindowsZone::isValid?('Ekaterinburg, oră standard', ['ro-RO'])).to be true
@@ -66,8 +73,8 @@ describe TimezoneParser do
66
73
  end
67
74
 
68
75
  describe '.getMetazones' do
69
- it 'should find metazones for "Južnoafriški poletni čas"' do
70
- expect(TimezoneParser::WindowsZone::getMetazones('Južnoafriški poletni čas')).to eq(['South Africa Standard Time'])
76
+ it 'should raise error' do
77
+ expect { TimezoneParser::WindowsZone::getMetazones('Južnoafriški poletni čas') }.to raise_error(StandardError)
71
78
  end
72
79
  end
73
80
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: TimezoneParser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dāvis
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: sqlite3
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: bundler
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -181,33 +195,27 @@ files:
181
195
  - Rakefile
182
196
  - TimezoneParser.gemspec
183
197
  - UNLICENSE
184
- - data/abbreviations.dat
185
198
  - data/abbreviations.yaml
186
- - data/countries.dat
187
199
  - data/countries.yaml
188
200
  - data/locales.yaml
189
- - data/metazones.dat
190
201
  - data/metazones.yaml
191
- - data/rails.dat
192
202
  - data/rails.yaml
193
- - data/rails_i18n.dat
194
203
  - data/rails_i18n.yaml
204
+ - data/schema.sql
195
205
  - data/territories.yaml
196
- - data/timezones.dat
206
+ - data/timezones.db
197
207
  - data/timezones.yaml
198
208
  - data/version.yaml
199
209
  - data/windows_locales.yaml
200
- - data/windows_offsets.dat
201
210
  - data/windows_offsets.yaml
202
- - data/windows_timezones.dat
203
211
  - data/windows_timezones.yaml
204
212
  - data/windows_tzres.yaml
205
- - data/windows_zonenames.dat
206
213
  - data/windows_zonenames.yaml
207
214
  - lib/timezone_parser.rb
208
215
  - lib/timezone_parser/abbreviation.rb
209
216
  - lib/timezone_parser/data.rb
210
217
  - lib/timezone_parser/data/cldr.rb
218
+ - lib/timezone_parser/data/exporter.rb
211
219
  - lib/timezone_parser/data/storage.rb
212
220
  - lib/timezone_parser/data/tzinfo.rb
213
221
  - lib/timezone_parser/data/windows.rb