enrico 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +23 -0
- data/Gemfile.lock +58 -0
- data/LICENSE.txt +20 -0
- data/README.md +0 -0
- data/README.rdoc +19 -0
- data/Rakefile +45 -0
- data/VERSION +1 -0
- data/enrico.gemspec +80 -0
- data/lib/enrico/country.rb +82 -0
- data/lib/enrico/vacation_day.rb +15 -0
- data/lib/enrico.rb +9 -0
- data/spec/fixtures/vcr_cassettes/is_public_holiday.yml +61 -0
- data/spec/fixtures/vcr_cassettes/public_holidays_in_date_range.yml +103 -0
- data/spec/fixtures/vcr_cassettes/public_holidays_in_month.yml +74 -0
- data/spec/fixtures/vcr_cassettes/public_holidays_in_year.yml +82 -0
- data/spec/fixtures/vcr_cassettes/supported_countries.yml +167 -0
- data/spec/lib/enrico/country_public_holidays_for_month_spec.rb +67 -0
- data/spec/lib/enrico/country_spec.rb +90 -0
- data/spec/lib/enrico/is_public_holiday_spec.rb +32 -0
- data/spec/lib/enrico/vacation_day_spec.rb +24 -0
- data/spec/spec_helper.rb +24 -0
- metadata +185 -0
@@ -0,0 +1,82 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://kayaposoft.com/enrico/json/v1.0/?action=getPublicHolidaysForYear&country=ger®ion=&year=2012
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message: OK
|
14
|
+
headers:
|
15
|
+
Server:
|
16
|
+
- nginx
|
17
|
+
Date:
|
18
|
+
- Thu, 29 Nov 2012 16:53:05 GMT
|
19
|
+
Content-Type:
|
20
|
+
- text/html
|
21
|
+
Content-Length:
|
22
|
+
- '1069'
|
23
|
+
Connection:
|
24
|
+
- keep-alive
|
25
|
+
Vary:
|
26
|
+
- User-Agent,Accept-Encoding
|
27
|
+
body:
|
28
|
+
encoding: US-ASCII
|
29
|
+
string: ! '[{"date":{"day":1,"month":1,"year":"2012","dayOfWeek":7},"localName":"Neujahrstag","englishName":"New
|
30
|
+
Year''s Day"},{"date":{"day":6,"month":4,"year":"2012","dayOfWeek":5},"localName":"Karfreitag","englishName":"Good
|
31
|
+
Friday"},{"date":{"day":9,"month":4,"year":"2012","dayOfWeek":1},"localName":"Ostermontag","englishName":"Easter
|
32
|
+
Monday"},{"date":{"day":1,"month":5,"year":"2012","dayOfWeek":2},"localName":"Tag
|
33
|
+
der Arbeit","englishName":"Labour Day"},{"date":{"day":17,"month":5,"year":"2012","dayOfWeek":4},"localName":"Christi
|
34
|
+
Himmelfahrt","englishName":"Ascension Day"},{"date":{"day":28,"month":5,"year":"2012","dayOfWeek":1},"localName":"Pfingstmontag","englishName":"Whit
|
35
|
+
Monday"},{"date":{"day":3,"month":10,"year":"2012","dayOfWeek":3},"localName":"Tag
|
36
|
+
der Deutschen Einheit","englishName":"German Unity Day"},{"date":{"day":25,"month":12,"year":"2012","dayOfWeek":2},"localName":"Weihnachtstag","englishName":"Christmas
|
37
|
+
Day"},{"date":{"day":26,"month":12,"year":"2012","dayOfWeek":3},"localName":"Zweiter
|
38
|
+
Weihnachtsfeiertag","englishName":"St. Stephen''s Day"}]'
|
39
|
+
http_version:
|
40
|
+
recorded_at: Thu, 29 Nov 2012 16:49:30 GMT
|
41
|
+
- request:
|
42
|
+
method: get
|
43
|
+
uri: http://kayaposoft.com/enrico/json/v1.0/?action=getSupportedCountries
|
44
|
+
body:
|
45
|
+
encoding: US-ASCII
|
46
|
+
string: ''
|
47
|
+
headers: {}
|
48
|
+
response:
|
49
|
+
status:
|
50
|
+
code: 200
|
51
|
+
message: OK
|
52
|
+
headers:
|
53
|
+
Server:
|
54
|
+
- nginx
|
55
|
+
Date:
|
56
|
+
- Thu, 29 Nov 2012 17:03:17 GMT
|
57
|
+
Content-Type:
|
58
|
+
- text/html
|
59
|
+
Content-Length:
|
60
|
+
- '5620'
|
61
|
+
Connection:
|
62
|
+
- keep-alive
|
63
|
+
Vary:
|
64
|
+
- User-Agent,Accept-Encoding
|
65
|
+
body:
|
66
|
+
encoding: US-ASCII
|
67
|
+
string: ! '[{"fullName":"Australia","countryCode":"aus","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":["Australian
|
68
|
+
Capital Territory","Queensland","New South Wales","Northern Territory","South
|
69
|
+
Australia","Tasmania","Victoria","Western Australia"]},{"fullName":"Austria","countryCode":"aut","fromDate":{"day":1,"month":1,"year":1946},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Belgium","countryCode":"bel","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Croatia","countryCode":"hrv","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Czech
|
70
|
+
Republic","countryCode":"cze","fromDate":{"day":1,"month":1,"year":1952},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Denmark","countryCode":"dnk","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"England","countryCode":"eng","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Estonia","countryCode":"est","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Finland","countryCode":"fin","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"France","countryCode":"fra","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":["Alsace","Moselle"]},{"fullName":"Germany","countryCode":"ger","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":["Baden-W\u00fcrttemberg","Bavaria","Berlin","Brandenburg","Bremen","Hamburg","Hesse","Mecklenburg-Vorpommern","Lower
|
71
|
+
Saxony","North Rhine-Westphalia","Rhineland-Palatinate","Saarland","Saxony","Saxony-Anhalt","Schleswig-Holstein","Thuringia"]},{"fullName":"Hungary","countryCode":"hun","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Iceland","countryCode":"isl","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Ireland","countryCode":"irl","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Italy","countryCode":"ita","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Japan","countryCode":"jpn","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Latvia","countryCode":"lva","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Lithuania","countryCode":"ltu","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Luxembourg","countryCode":"lux","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Netherlands","countryCode":"nld","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"New
|
72
|
+
Zealand","countryCode":"nzl","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":["Auckland","Canterbury","Chatham
|
73
|
+
Islands","Hawkes'' Bay","Marlborough","Nelson","Otago","South Canterbury","Southland","Taranaki","Wellington","Westland"]},{"fullName":"Northern
|
74
|
+
Ireland","countryCode":"nir","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Norway","countryCode":"nor","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Poland","countryCode":"pol","fromDate":{"day":1,"month":1,"year":1952},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Portugal","countryCode":"prt","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Serbia","countryCode":"srb","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Slovakia","countryCode":"svk","fromDate":{"day":1,"month":1,"year":1952},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Slovenia","countryCode":"svn","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Sweden","countryCode":"swe","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"United
|
75
|
+
States of America","countryCode":"usa","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":["Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","District
|
76
|
+
Of Columbia","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New
|
77
|
+
Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode
|
78
|
+
Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West
|
79
|
+
Virginia","Wisconsin","Wyoming"]},{"fullName":"Wales","countryCode":"wal","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]}]'
|
80
|
+
http_version:
|
81
|
+
recorded_at: Thu, 29 Nov 2012 16:59:42 GMT
|
82
|
+
recorded_with: VCR 2.3.0
|
@@ -0,0 +1,167 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://kayaposoft.com/enrico/json/v1.0/?action=getSupportedCountries
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message: OK
|
14
|
+
headers:
|
15
|
+
Server:
|
16
|
+
- nginx
|
17
|
+
Date:
|
18
|
+
- Thu, 29 Nov 2012 16:53:05 GMT
|
19
|
+
Content-Type:
|
20
|
+
- text/html
|
21
|
+
Content-Length:
|
22
|
+
- '5620'
|
23
|
+
Connection:
|
24
|
+
- keep-alive
|
25
|
+
Vary:
|
26
|
+
- User-Agent,Accept-Encoding
|
27
|
+
body:
|
28
|
+
encoding: US-ASCII
|
29
|
+
string: ! '[{"fullName":"Australia","countryCode":"aus","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":["Australian
|
30
|
+
Capital Territory","Queensland","New South Wales","Northern Territory","South
|
31
|
+
Australia","Tasmania","Victoria","Western Australia"]},{"fullName":"Austria","countryCode":"aut","fromDate":{"day":1,"month":1,"year":1946},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Belgium","countryCode":"bel","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Croatia","countryCode":"hrv","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Czech
|
32
|
+
Republic","countryCode":"cze","fromDate":{"day":1,"month":1,"year":1952},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Denmark","countryCode":"dnk","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"England","countryCode":"eng","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Estonia","countryCode":"est","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Finland","countryCode":"fin","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"France","countryCode":"fra","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":["Alsace","Moselle"]},{"fullName":"Germany","countryCode":"ger","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":["Baden-W\u00fcrttemberg","Bavaria","Berlin","Brandenburg","Bremen","Hamburg","Hesse","Mecklenburg-Vorpommern","Lower
|
33
|
+
Saxony","North Rhine-Westphalia","Rhineland-Palatinate","Saarland","Saxony","Saxony-Anhalt","Schleswig-Holstein","Thuringia"]},{"fullName":"Hungary","countryCode":"hun","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Iceland","countryCode":"isl","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Ireland","countryCode":"irl","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Italy","countryCode":"ita","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Japan","countryCode":"jpn","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Latvia","countryCode":"lva","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Lithuania","countryCode":"ltu","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Luxembourg","countryCode":"lux","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Netherlands","countryCode":"nld","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"New
|
34
|
+
Zealand","countryCode":"nzl","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":["Auckland","Canterbury","Chatham
|
35
|
+
Islands","Hawkes'' Bay","Marlborough","Nelson","Otago","South Canterbury","Southland","Taranaki","Wellington","Westland"]},{"fullName":"Northern
|
36
|
+
Ireland","countryCode":"nir","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Norway","countryCode":"nor","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Poland","countryCode":"pol","fromDate":{"day":1,"month":1,"year":1952},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Portugal","countryCode":"prt","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Serbia","countryCode":"srb","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Slovakia","countryCode":"svk","fromDate":{"day":1,"month":1,"year":1952},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Slovenia","countryCode":"svn","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Sweden","countryCode":"swe","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"United
|
37
|
+
States of America","countryCode":"usa","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":["Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","District
|
38
|
+
Of Columbia","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New
|
39
|
+
Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode
|
40
|
+
Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West
|
41
|
+
Virginia","Wisconsin","Wyoming"]},{"fullName":"Wales","countryCode":"wal","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]}]'
|
42
|
+
http_version:
|
43
|
+
recorded_at: Thu, 29 Nov 2012 16:49:30 GMT
|
44
|
+
- request:
|
45
|
+
method: get
|
46
|
+
uri: http://kayaposoft.com/enrico/json/v1.0/?action=getSupportedCountries
|
47
|
+
body:
|
48
|
+
encoding: US-ASCII
|
49
|
+
string: ''
|
50
|
+
headers: {}
|
51
|
+
response:
|
52
|
+
status:
|
53
|
+
code: 200
|
54
|
+
message: OK
|
55
|
+
headers:
|
56
|
+
Server:
|
57
|
+
- nginx
|
58
|
+
Date:
|
59
|
+
- Thu, 29 Nov 2012 16:53:05 GMT
|
60
|
+
Content-Type:
|
61
|
+
- text/html
|
62
|
+
Content-Length:
|
63
|
+
- '5620'
|
64
|
+
Connection:
|
65
|
+
- keep-alive
|
66
|
+
Vary:
|
67
|
+
- User-Agent,Accept-Encoding
|
68
|
+
body:
|
69
|
+
encoding: US-ASCII
|
70
|
+
string: ! '[{"fullName":"Australia","countryCode":"aus","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":["Australian
|
71
|
+
Capital Territory","Queensland","New South Wales","Northern Territory","South
|
72
|
+
Australia","Tasmania","Victoria","Western Australia"]},{"fullName":"Austria","countryCode":"aut","fromDate":{"day":1,"month":1,"year":1946},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Belgium","countryCode":"bel","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Croatia","countryCode":"hrv","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Czech
|
73
|
+
Republic","countryCode":"cze","fromDate":{"day":1,"month":1,"year":1952},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Denmark","countryCode":"dnk","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"England","countryCode":"eng","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Estonia","countryCode":"est","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Finland","countryCode":"fin","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"France","countryCode":"fra","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":["Alsace","Moselle"]},{"fullName":"Germany","countryCode":"ger","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":["Baden-W\u00fcrttemberg","Bavaria","Berlin","Brandenburg","Bremen","Hamburg","Hesse","Mecklenburg-Vorpommern","Lower
|
74
|
+
Saxony","North Rhine-Westphalia","Rhineland-Palatinate","Saarland","Saxony","Saxony-Anhalt","Schleswig-Holstein","Thuringia"]},{"fullName":"Hungary","countryCode":"hun","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Iceland","countryCode":"isl","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Ireland","countryCode":"irl","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Italy","countryCode":"ita","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Japan","countryCode":"jpn","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Latvia","countryCode":"lva","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Lithuania","countryCode":"ltu","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Luxembourg","countryCode":"lux","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Netherlands","countryCode":"nld","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"New
|
75
|
+
Zealand","countryCode":"nzl","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":["Auckland","Canterbury","Chatham
|
76
|
+
Islands","Hawkes'' Bay","Marlborough","Nelson","Otago","South Canterbury","Southland","Taranaki","Wellington","Westland"]},{"fullName":"Northern
|
77
|
+
Ireland","countryCode":"nir","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Norway","countryCode":"nor","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Poland","countryCode":"pol","fromDate":{"day":1,"month":1,"year":1952},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Portugal","countryCode":"prt","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Serbia","countryCode":"srb","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Slovakia","countryCode":"svk","fromDate":{"day":1,"month":1,"year":1952},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Slovenia","countryCode":"svn","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Sweden","countryCode":"swe","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"United
|
78
|
+
States of America","countryCode":"usa","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":["Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","District
|
79
|
+
Of Columbia","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New
|
80
|
+
Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode
|
81
|
+
Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West
|
82
|
+
Virginia","Wisconsin","Wyoming"]},{"fullName":"Wales","countryCode":"wal","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]}]'
|
83
|
+
http_version:
|
84
|
+
recorded_at: Thu, 29 Nov 2012 16:49:30 GMT
|
85
|
+
- request:
|
86
|
+
method: get
|
87
|
+
uri: http://kayaposoft.com/enrico/json/v1.0/?action=getSupportedCountries
|
88
|
+
body:
|
89
|
+
encoding: US-ASCII
|
90
|
+
string: ''
|
91
|
+
headers: {}
|
92
|
+
response:
|
93
|
+
status:
|
94
|
+
code: 200
|
95
|
+
message: OK
|
96
|
+
headers:
|
97
|
+
Server:
|
98
|
+
- nginx
|
99
|
+
Date:
|
100
|
+
- Thu, 29 Nov 2012 16:53:05 GMT
|
101
|
+
Content-Type:
|
102
|
+
- text/html
|
103
|
+
Content-Length:
|
104
|
+
- '5620'
|
105
|
+
Connection:
|
106
|
+
- keep-alive
|
107
|
+
Vary:
|
108
|
+
- User-Agent,Accept-Encoding
|
109
|
+
body:
|
110
|
+
encoding: US-ASCII
|
111
|
+
string: ! '[{"fullName":"Australia","countryCode":"aus","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":["Australian
|
112
|
+
Capital Territory","Queensland","New South Wales","Northern Territory","South
|
113
|
+
Australia","Tasmania","Victoria","Western Australia"]},{"fullName":"Austria","countryCode":"aut","fromDate":{"day":1,"month":1,"year":1946},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Belgium","countryCode":"bel","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Croatia","countryCode":"hrv","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Czech
|
114
|
+
Republic","countryCode":"cze","fromDate":{"day":1,"month":1,"year":1952},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Denmark","countryCode":"dnk","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"England","countryCode":"eng","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Estonia","countryCode":"est","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Finland","countryCode":"fin","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"France","countryCode":"fra","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":["Alsace","Moselle"]},{"fullName":"Germany","countryCode":"ger","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":["Baden-W\u00fcrttemberg","Bavaria","Berlin","Brandenburg","Bremen","Hamburg","Hesse","Mecklenburg-Vorpommern","Lower
|
115
|
+
Saxony","North Rhine-Westphalia","Rhineland-Palatinate","Saarland","Saxony","Saxony-Anhalt","Schleswig-Holstein","Thuringia"]},{"fullName":"Hungary","countryCode":"hun","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Iceland","countryCode":"isl","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Ireland","countryCode":"irl","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Italy","countryCode":"ita","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Japan","countryCode":"jpn","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Latvia","countryCode":"lva","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Lithuania","countryCode":"ltu","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Luxembourg","countryCode":"lux","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Netherlands","countryCode":"nld","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"New
|
116
|
+
Zealand","countryCode":"nzl","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":["Auckland","Canterbury","Chatham
|
117
|
+
Islands","Hawkes'' Bay","Marlborough","Nelson","Otago","South Canterbury","Southland","Taranaki","Wellington","Westland"]},{"fullName":"Northern
|
118
|
+
Ireland","countryCode":"nir","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Norway","countryCode":"nor","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Poland","countryCode":"pol","fromDate":{"day":1,"month":1,"year":1952},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Portugal","countryCode":"prt","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Serbia","countryCode":"srb","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Slovakia","countryCode":"svk","fromDate":{"day":1,"month":1,"year":1952},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Slovenia","countryCode":"svn","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Sweden","countryCode":"swe","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"United
|
119
|
+
States of America","countryCode":"usa","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":["Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","District
|
120
|
+
Of Columbia","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New
|
121
|
+
Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode
|
122
|
+
Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West
|
123
|
+
Virginia","Wisconsin","Wyoming"]},{"fullName":"Wales","countryCode":"wal","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]}]'
|
124
|
+
http_version:
|
125
|
+
recorded_at: Thu, 29 Nov 2012 16:49:30 GMT
|
126
|
+
- request:
|
127
|
+
method: get
|
128
|
+
uri: http://kayaposoft.com/enrico/json/v1.0/?action=getSupportedCountries
|
129
|
+
body:
|
130
|
+
encoding: US-ASCII
|
131
|
+
string: ''
|
132
|
+
headers: {}
|
133
|
+
response:
|
134
|
+
status:
|
135
|
+
code: 200
|
136
|
+
message: OK
|
137
|
+
headers:
|
138
|
+
Server:
|
139
|
+
- nginx
|
140
|
+
Date:
|
141
|
+
- Thu, 29 Nov 2012 16:53:05 GMT
|
142
|
+
Content-Type:
|
143
|
+
- text/html
|
144
|
+
Content-Length:
|
145
|
+
- '5620'
|
146
|
+
Connection:
|
147
|
+
- keep-alive
|
148
|
+
Vary:
|
149
|
+
- User-Agent,Accept-Encoding
|
150
|
+
body:
|
151
|
+
encoding: US-ASCII
|
152
|
+
string: ! '[{"fullName":"Australia","countryCode":"aus","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":["Australian
|
153
|
+
Capital Territory","Queensland","New South Wales","Northern Territory","South
|
154
|
+
Australia","Tasmania","Victoria","Western Australia"]},{"fullName":"Austria","countryCode":"aut","fromDate":{"day":1,"month":1,"year":1946},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Belgium","countryCode":"bel","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Croatia","countryCode":"hrv","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Czech
|
155
|
+
Republic","countryCode":"cze","fromDate":{"day":1,"month":1,"year":1952},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Denmark","countryCode":"dnk","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"England","countryCode":"eng","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Estonia","countryCode":"est","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Finland","countryCode":"fin","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"France","countryCode":"fra","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":["Alsace","Moselle"]},{"fullName":"Germany","countryCode":"ger","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":["Baden-W\u00fcrttemberg","Bavaria","Berlin","Brandenburg","Bremen","Hamburg","Hesse","Mecklenburg-Vorpommern","Lower
|
156
|
+
Saxony","North Rhine-Westphalia","Rhineland-Palatinate","Saarland","Saxony","Saxony-Anhalt","Schleswig-Holstein","Thuringia"]},{"fullName":"Hungary","countryCode":"hun","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Iceland","countryCode":"isl","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Ireland","countryCode":"irl","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Italy","countryCode":"ita","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Japan","countryCode":"jpn","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Latvia","countryCode":"lva","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Lithuania","countryCode":"ltu","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Luxembourg","countryCode":"lux","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Netherlands","countryCode":"nld","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"New
|
157
|
+
Zealand","countryCode":"nzl","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":["Auckland","Canterbury","Chatham
|
158
|
+
Islands","Hawkes'' Bay","Marlborough","Nelson","Otago","South Canterbury","Southland","Taranaki","Wellington","Westland"]},{"fullName":"Northern
|
159
|
+
Ireland","countryCode":"nir","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Norway","countryCode":"nor","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Poland","countryCode":"pol","fromDate":{"day":1,"month":1,"year":1952},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Portugal","countryCode":"prt","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Serbia","countryCode":"srb","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Slovakia","countryCode":"svk","fromDate":{"day":1,"month":1,"year":1952},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Slovenia","countryCode":"svn","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"Sweden","countryCode":"swe","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]},{"fullName":"United
|
160
|
+
States of America","countryCode":"usa","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":["Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","District
|
161
|
+
Of Columbia","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New
|
162
|
+
Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode
|
163
|
+
Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West
|
164
|
+
Virginia","Wisconsin","Wyoming"]},{"fullName":"Wales","countryCode":"wal","fromDate":{"day":1,"month":1,"year":2011},"toDate":{"day":31,"month":12,"year":32767},"regions":[]}]'
|
165
|
+
http_version:
|
166
|
+
recorded_at: Thu, 29 Nov 2012 16:49:30 GMT
|
167
|
+
recorded_with: VCR 2.3.0
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require_relative '../../spec_helper'
|
4
|
+
# For Ruby < 1.9.3, use this instead of require_relative
|
5
|
+
# require (File.expand_path('./../../../spec_helper', __FILE__))
|
6
|
+
|
7
|
+
describe Enrico::Country do
|
8
|
+
|
9
|
+
describe "GET getPublicHolidaysForMonth" do
|
10
|
+
before(:each) do
|
11
|
+
VCR.insert_cassette 'public_holidays_in_month', :record => :new_episodes
|
12
|
+
end
|
13
|
+
|
14
|
+
after(:each) do
|
15
|
+
VCR.eject_cassette
|
16
|
+
end
|
17
|
+
let(:country) { Enrico::Country.new("ger") }
|
18
|
+
it "should return all holidays in month" do
|
19
|
+
date = Date.today.beginning_of_year
|
20
|
+
dates = country.public_holidays_for_month(date)
|
21
|
+
dates.first.date = Date.today.beginning_of_year
|
22
|
+
dates.first.local_name = "Neujahrstag"
|
23
|
+
dates.first.english_name = "New Year's Day"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "GET getPublicHolidaysForYear" do
|
28
|
+
before(:each) do
|
29
|
+
VCR.insert_cassette 'public_holidays_in_year', :record => :new_episodes
|
30
|
+
end
|
31
|
+
|
32
|
+
after(:each) do
|
33
|
+
VCR.eject_cassette
|
34
|
+
end
|
35
|
+
let(:country) { Enrico::Country.new("ger") }
|
36
|
+
it "should return all holidays in month" do
|
37
|
+
date = Date.today.beginning_of_year
|
38
|
+
dates = country.public_holidays_for_year(date)
|
39
|
+
dates.first.date = Date.today.beginning_of_year
|
40
|
+
dates.first.local_name = "Neujahrstag"
|
41
|
+
dates.first.english_name = "New Year's Day"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe "GET getPublicHolidaysForDateRange" do
|
46
|
+
before(:each) do
|
47
|
+
VCR.insert_cassette 'public_holidays_in_date_range', :record => :new_episodes
|
48
|
+
end
|
49
|
+
|
50
|
+
after(:each) do
|
51
|
+
VCR.eject_cassette
|
52
|
+
end
|
53
|
+
let(:country) { Enrico::Country.new("ger") }
|
54
|
+
it "should return all holidays in date range" do
|
55
|
+
start_date = Date.today.beginning_of_year
|
56
|
+
end_date = Date.today.beginning_of_year + 2.month
|
57
|
+
|
58
|
+
dates = country.public_holidays_for_date_range(start_date, end_date)
|
59
|
+
|
60
|
+
dates.first.date = Date.today.beginning_of_year
|
61
|
+
dates.first.local_name = "Neujahrstag"
|
62
|
+
dates.first.english_name = "New Year's Day"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require_relative '../../spec_helper'
|
4
|
+
# For Ruby < 1.9.3, use this instead of require_relative
|
5
|
+
# require (File.expand_path('./../../../spec_helper', __FILE__))
|
6
|
+
|
7
|
+
describe Enrico::Country do
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
VCR.insert_cassette 'supported_countries', :record => :new_episodes
|
11
|
+
end
|
12
|
+
|
13
|
+
after(:each) do
|
14
|
+
VCR.eject_cassette
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "default attributes" do
|
18
|
+
it "must include httparty methods" do
|
19
|
+
Enrico::Country.must_include HTTParty
|
20
|
+
end
|
21
|
+
it "must have the base url set to the Dribble API endpoint" do
|
22
|
+
Enrico::Country.base_uri.must_equal 'http://kayaposoft.com/enrico/json/v1.0'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "GET SupportedCountries" do
|
27
|
+
|
28
|
+
it "records the fixture" do
|
29
|
+
Enrico::Country.get('/?action=getSupportedCountries')
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "get list of all supported countries" do
|
33
|
+
|
34
|
+
it "must have all method" do
|
35
|
+
Enrico::Country.must_respond_to :all
|
36
|
+
end
|
37
|
+
|
38
|
+
it "must parse the api response from JSON to Hash" do
|
39
|
+
Enrico::Country.all.must_be_instance_of Array
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "default instance attributes" do
|
45
|
+
let(:country) { Enrico::Country.new("ger") }
|
46
|
+
|
47
|
+
it "must have an country_code attribute" do
|
48
|
+
country.must_respond_to :country_code
|
49
|
+
end
|
50
|
+
|
51
|
+
it "must have the right id" do
|
52
|
+
country.country_code.must_equal 'ger'
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
describe "get list of all supported countries" do
|
58
|
+
|
59
|
+
let(:country) { Enrico::Country.new("ger") }
|
60
|
+
|
61
|
+
it "must have a country method" do
|
62
|
+
country.must_respond_to :details
|
63
|
+
end
|
64
|
+
|
65
|
+
it "must repond with the details of a country" do
|
66
|
+
country.full_name.must_equal 'Germany'
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should respond with the fromDate" do
|
70
|
+
format = {"day"=>1, "month"=>1, "year"=>2011}
|
71
|
+
country.from_date.must_equal format
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should respond with toDate" do
|
75
|
+
toDate = {"day"=>31, "month"=>12, "year"=>32767}
|
76
|
+
country.toDate.must_equal toDate
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should respond with regions" do
|
80
|
+
regions = ["Baden-Württemberg", "Bavaria", "Berlin", "Brandenburg", "Bremen", "Hamburg", "Hesse", "Mecklenburg-Vorpommern", "Lower Saxony", "North Rhine-Westphalia", "Rhineland-Palatinate", "Saarland", "Saxony", "Saxony-Anhalt", "Schleswig-Holstein", "Thuringia"]
|
81
|
+
country.regions.must_be_instance_of Array
|
82
|
+
country.regions.must_equal regions
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require_relative '../../spec_helper'
|
4
|
+
# For Ruby < 1.9.3, use this instead of require_relative
|
5
|
+
# require (File.expand_path('./../../../spec_helper', __FILE__))
|
6
|
+
|
7
|
+
describe Enrico::Country do
|
8
|
+
|
9
|
+
describe "GET isPublicHoliday" do
|
10
|
+
before(:each) do
|
11
|
+
VCR.insert_cassette 'is_public_holiday', :record => :new_episodes
|
12
|
+
end
|
13
|
+
after(:each) do
|
14
|
+
VCR.eject_cassette
|
15
|
+
end
|
16
|
+
|
17
|
+
let(:country) { Enrico::Country.new("ger") }
|
18
|
+
|
19
|
+
it "should trueify that date is public holiday" do
|
20
|
+
date = Date.today.beginning_of_year
|
21
|
+
country.is_public_holiday?(date).must_equal true
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should falsify that date is public holiday" do
|
25
|
+
date = Date.today.beginning_of_year + 28.days
|
26
|
+
country.is_public_holiday?(date).must_equal false
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require_relative '../../spec_helper'
|
4
|
+
# For Ruby < 1.9.3, use this instead of require_relative
|
5
|
+
# require (File.expand_path('./../../../spec_helper', __FILE__))
|
6
|
+
|
7
|
+
describe Enrico::VacationDay do
|
8
|
+
|
9
|
+
describe "default instance attributes" do
|
10
|
+
let(:vacatin_date) {
|
11
|
+
Enrico::VacationDay.new(Date.today.beginning_of_year, "Neujahrstag", "New Year's Day")
|
12
|
+
}
|
13
|
+
|
14
|
+
it "test different initializer methods" do
|
15
|
+
rsp = {"date"=>{"day"=>1, "month"=>1, "year"=>"2012", "dayOfWeek"=>7}, "localName"=>"Neujahrstag", "englishName"=>"New Year's Day"}
|
16
|
+
day = Enrico::VacationDay.new(rsp)
|
17
|
+
day.date.must_equal Date.today.beginning_of_year
|
18
|
+
day.local_name.must_equal "Neujahrstag"
|
19
|
+
day.english_name.must_equal "New Year's Day"
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#we need the actual library file
|
2
|
+
require_relative '../lib/enrico'
|
3
|
+
# For Ruby < 1.9.3, use this instead of require_relative
|
4
|
+
# require(File.expand_path('../../lib/dish', __FILE__))
|
5
|
+
#dependencies
|
6
|
+
require 'minitest/autorun'
|
7
|
+
require 'webmock/minitest'
|
8
|
+
require 'vcr'
|
9
|
+
# require 'turn'
|
10
|
+
|
11
|
+
# Turn.config do |c|
|
12
|
+
# :outline - turn's original case/test outline mode [default]
|
13
|
+
# c.format = :outline
|
14
|
+
# turn on invoke/execute tracing, enable full backtrace
|
15
|
+
# c.trace = true
|
16
|
+
# use humanized test names (works only with :outline format)
|
17
|
+
# c.natural = true
|
18
|
+
# end
|
19
|
+
|
20
|
+
#VCR config
|
21
|
+
VCR.configure do |c|
|
22
|
+
c.cassette_library_dir = './spec/fixtures/vcr_cassettes'
|
23
|
+
c.hook_into :webmock # or :fakeweb
|
24
|
+
end
|