fonecal 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +18 -3
- data/fonecal.gemspec +15 -15
- data/lib/fonecal/calendar.rb +2 -2
- data/lib/fonecal/crawler.rb +1 -1
- data/lib/fonecal/event.rb +24 -13
- data/lib/fonecal/grand_prix.rb +9 -7
- data/lib/fonecal/version.rb +1 -1
- data/spec/abu_dabi_gp_spec.rb +124 -0
- data/spec/australian_gp_spec.rb +123 -0
- data/spec/belgian_gp_spec.rb +31 -0
- data/spec/brazilian_gp_spec.rb +166 -0
- data/spec/canadian_gp_spec.rb +122 -0
- data/spec/fonecal_spec.rb +3 -5
- data/spec/grand_prix_spec.rb +244 -15
- data/spec/hungarian_gp_spec.rb +111 -0
- metadata +19 -9
- data/f1cal.ical +0 -860
- data/lib/fonecal/fonecal_spec.rb +0 -7
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'fonecal'
|
2
|
+
|
3
|
+
describe Fonecal::GrandPrix do
|
4
|
+
describe "Getting Belgian GP info" do
|
5
|
+
let(:belgianGP) { Fonecal::GrandPrix.new("http://www.formula1.com/races/in_detail/belgium_927/circuit_diagram.html") }
|
6
|
+
|
7
|
+
it "should have the correct race title" do
|
8
|
+
belgianGP.raceTitle.should eql "2014 Formula 1 Shell Belgian Grand Prix"
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should get a country" do
|
12
|
+
belgianGP.country.should eql "Belgium"
|
13
|
+
end
|
14
|
+
|
15
|
+
it "has location object" do
|
16
|
+
belgianGP.location.should_not be_nil
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "its events" do
|
20
|
+
describe "Practice 1" do
|
21
|
+
it "should have the right name" do
|
22
|
+
belgianGP.events.first.name.should eql "Practice 1"
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should have the correct start time" do
|
26
|
+
belgianGP.events.first.start.should eql Time.new(2014, 8, 22, 10, 0, 0, '+02:00')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,166 @@
|
|
1
|
+
require 'fonecal'
|
2
|
+
require 'active_support/time'
|
3
|
+
|
4
|
+
describe Fonecal::GrandPrix do
|
5
|
+
describe "Brazillian GP" do
|
6
|
+
subject(:brazilianGP) { Fonecal::GrandPrix.new('http://www.formula1.com/races/in_detail/brazil_935/circuit_diagram.html') }
|
7
|
+
|
8
|
+
it "should have the correct race title" do
|
9
|
+
expect(brazilianGP.raceTitle).to eql "Formula 1 Grande Premio Petrobras Do Brasil 2014"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should be in Brazil" do
|
13
|
+
expect(brazilianGP.country).to eql "Brazil"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should be in Montreal" do
|
17
|
+
expect(brazilianGP.city).to eql "São Paulo"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should be in the BRT timezone" do
|
21
|
+
expect(brazilianGP.timezone.zone).to eql "America/Sao_Paulo"
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should have 5 events" do
|
25
|
+
expect(brazilianGP.events.count).to eql 5
|
26
|
+
end
|
27
|
+
|
28
|
+
context "practice 1" do
|
29
|
+
subject(:p1) { brazilianGP.events.first }
|
30
|
+
|
31
|
+
it "should be of type Practice" do
|
32
|
+
expect(p1.class).to eql Fonecal::Practice
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should start at 10:00 BRT on friday" do
|
36
|
+
Time.zone = brazilianGP.timezone.zone
|
37
|
+
expect(p1.start).to eql Time.zone.local(2014, 11, 7, 10, 0, 0)
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should start at 13:00 CET on friday" do
|
41
|
+
Time.zone = 'Europe/Copenhagen'
|
42
|
+
expect(p1.start).to eql Time.zone.local(2014, 11, 7, 13, 0, 0)
|
43
|
+
end
|
44
|
+
|
45
|
+
#it "should end at 11:30 BRT on friday" do
|
46
|
+
# Time.zone = brazilianGP.timezone.zone
|
47
|
+
# expect(p1.end).to eql Time.zone.local(2014, 11, 7, 11, 30, 0)
|
48
|
+
#end
|
49
|
+
|
50
|
+
#it "should end at 14:30 CET on friday" do
|
51
|
+
# Time.zone = 'Europe/Copenhagen'
|
52
|
+
# expect(p1.end).to eql Time.zone.local(2014, 11, 7, 14, 30, 0)
|
53
|
+
#end
|
54
|
+
end
|
55
|
+
|
56
|
+
#context "practice 2" do
|
57
|
+
# subject(:p2) { brazilianGP.events[1] }
|
58
|
+
|
59
|
+
# it "should be of type Practice" do
|
60
|
+
# expect(p2.class).to eql Fonecal::Practice
|
61
|
+
# end
|
62
|
+
|
63
|
+
# it "should start at 14:00 BRT on friday" do
|
64
|
+
# Time.zone = brazilianGP.timezone.zone
|
65
|
+
# expect(p2.start).to eql Time.zone.local(2014, 11, 7, 14, 0, 0)
|
66
|
+
# end
|
67
|
+
|
68
|
+
# it "should start at 17:00 CET on friday" do
|
69
|
+
# Time.zone = 'Europe/Copenhagen'
|
70
|
+
# expect(p2.start).to eql Time.zone.local(2014, 11, 7, 17, 0, 0)
|
71
|
+
# end
|
72
|
+
|
73
|
+
# it "should end at 15:30 BRT on friday" do
|
74
|
+
# Time.zone = brazilianGP.timezone.zone
|
75
|
+
# expect(p2.end).to eql Time.zone.local(2014, 11, 7, 15, 30, 0)
|
76
|
+
# end
|
77
|
+
# it "should end at 18:30 CET on friday" do
|
78
|
+
# Time.zone = 'Europe/Copenhagen'
|
79
|
+
# expect(p2.end).to eql Time.zone.local(2014, 11, 7, 18, 30, 0)
|
80
|
+
# end
|
81
|
+
#end
|
82
|
+
|
83
|
+
#context "practice 3" do
|
84
|
+
# subject(:p3) { brazilianGP.events[2] }
|
85
|
+
|
86
|
+
# it "should be of type Practice" do
|
87
|
+
# expect(p3.class).to eql Fonecal::Practice
|
88
|
+
# end
|
89
|
+
|
90
|
+
# it "should start at 14:00 BRT on saturday" do
|
91
|
+
# Time.zone = brazilianGP.timezone.zone
|
92
|
+
# expect(p3.start).to eql Time.zone.local(2014, 11, 8, 14, 0, 0)
|
93
|
+
# end
|
94
|
+
|
95
|
+
# it "should start at 16:00 CET on saturday" do
|
96
|
+
# Time.zone = 'Europe/Copenhagen'
|
97
|
+
# expect(p3.start).to eql Time.zone.local(2014, 11, 8, 11, 0, 0)
|
98
|
+
# end
|
99
|
+
|
100
|
+
# it "should end at 17:00 BRT on saturday" do
|
101
|
+
# Time.zone = brazilianGP.timezone.zone
|
102
|
+
# expect(p3.end).to eql Time.zone.local(2014, 11, 8, 15, 0, 0)
|
103
|
+
# end
|
104
|
+
|
105
|
+
# it "should end at 17:00 CET on saturday" do
|
106
|
+
# Time.zone = 'Europe/Copenhagen'
|
107
|
+
# expect(p3.end).to eql Time.zone.local(2014, 11, 8, 12, 0, 0)
|
108
|
+
# end
|
109
|
+
#end
|
110
|
+
|
111
|
+
#context "qualifying" do
|
112
|
+
# subject(:q) { brazilianGP.events[3] }
|
113
|
+
|
114
|
+
# it "should be of type Practice" do
|
115
|
+
# expect(q.class).to eql Fonecal::Qualifying
|
116
|
+
# end
|
117
|
+
|
118
|
+
# it "should start at 14:00 BRT on saturday" do
|
119
|
+
# Time.zone = brazilianGP.timezone.zone
|
120
|
+
# expect(q.start).to eql Time.zone.local(2014, 11, 8, 14, 0, 0)
|
121
|
+
# end
|
122
|
+
|
123
|
+
# it "should start at 17:00 CET on saturday" do
|
124
|
+
# Time.zone = 'Europe/Copenhagen'
|
125
|
+
# expect(q.start).to eql Time.zone.local(2014, 11, 8, 17, 0, 0)
|
126
|
+
# end
|
127
|
+
|
128
|
+
# it "should end at 15:30 BRT on saturday" do
|
129
|
+
# Time.zone = brazilianGP.timezone.zone
|
130
|
+
# expect(q.end).to eql Time.zone.local(2014, 11, 8, 15, 30, 0)
|
131
|
+
# end
|
132
|
+
|
133
|
+
# it "should end at 18:30 CET on saturday" do
|
134
|
+
# Time.zone = 'Europe/Copenhagen'
|
135
|
+
# expect(q.end).to eql Time.zone.local(2014, 11, 8, 18, 30, 0)
|
136
|
+
# end
|
137
|
+
#end
|
138
|
+
|
139
|
+
#context "race" do
|
140
|
+
# subject(:race) { brazilianGP.events.last }
|
141
|
+
|
142
|
+
# it "should be of type Race" do
|
143
|
+
# expect(race.class).to eql Fonecal::Race
|
144
|
+
# end
|
145
|
+
|
146
|
+
# it "should start at 14:00 BRT on sunday" do
|
147
|
+
# Time.zone = brazilianGP.timezone.zone
|
148
|
+
# expect(race.start).to eql Time.zone.local(2014, 11, 9, 14, 0, 0)
|
149
|
+
# end
|
150
|
+
# it "should start at 17:00 CST on sunday" do
|
151
|
+
# Time.zone = 'Europe/Copenhagen'
|
152
|
+
# expect(race.start).to eql Time.zone.local(2014, 11, 9, 17, 0, 0)
|
153
|
+
# end
|
154
|
+
|
155
|
+
# it "should end at 18:00 BRT on sunday" do
|
156
|
+
# Time.zone = brazilianGP.timezone.zone
|
157
|
+
# expect(race.end).to eql Time.zone.local(2014, 11, 9, 18, 0, 0)
|
158
|
+
# end
|
159
|
+
|
160
|
+
# it "should start at 21:00 CET on sunday" do
|
161
|
+
# Time.zone = 'Europe/Copenhagen'
|
162
|
+
# expect(race.end).to eql Time.zone.local(2014, 11, 9, 21, 0, 0)
|
163
|
+
# end
|
164
|
+
#end
|
165
|
+
end
|
166
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
require 'fonecal'
|
2
|
+
|
3
|
+
describe Fonecal::GrandPrix do
|
4
|
+
describe "Canadian GP" do
|
5
|
+
subject(:canadianGP) { Fonecal::GrandPrix.new('http://www.formula1.com/races/in_detail/canada_922/circuit_diagram.html') }
|
6
|
+
|
7
|
+
it "should have the correct race title" do
|
8
|
+
expect(canadianGP.raceTitle).to eql "Formula 1 Grand Prix Du Canada 2014"
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should be in Canada" do
|
12
|
+
expect(canadianGP.country).to eql "Canada"
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should be in Montreal" do
|
16
|
+
#expect(canadianGP.city).to eql "Montreal"
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should be in the EST timezone" do
|
20
|
+
estTS = Timezone::Zone.new(zone: "EST")
|
21
|
+
montrealTS = Timezone::Zone.new(zone: "America/Montreal")
|
22
|
+
now = Time.now
|
23
|
+
|
24
|
+
#expect(canadianGP.timezone.time(now).to_i).to eq estTS.time(now).to_i
|
25
|
+
expect(canadianGP.timezone.time(now).to_i).to eq montrealTS.time(now).to_i
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should have 5 events" do
|
29
|
+
expect(canadianGP.events.count).to eql 5
|
30
|
+
end
|
31
|
+
|
32
|
+
context "practice 1" do
|
33
|
+
subject(:p1) { canadianGP.events.first }
|
34
|
+
|
35
|
+
it "should be of type Practice" do
|
36
|
+
expect(p1.class).to eql Fonecal::Practice
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should start at 16:00 CET on friday" do
|
40
|
+
expect(p1.start).to eql Time.new(2014, 6, 6, 16, 0, 0, '+02:00')
|
41
|
+
expect(p1.start).to eql Time.new(2014, 6, 6, 10, 0, 0, '-04:00')
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should end at 17:30 CET on friday" do
|
45
|
+
expect(p1.end).to eql Time.new(2014, 6, 6, 17, 30, 0, '+02:00')
|
46
|
+
expect(p1.end).to eql Time.new(2014, 6, 6, 11, 30, 0, '-04:00')
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context "practice 2" do
|
51
|
+
subject(:p2) { canadianGP.events[1] }
|
52
|
+
|
53
|
+
it "should be of type Practice" do
|
54
|
+
expect(p2.class).to eql Fonecal::Practice
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should start at 20:00 on friday" do
|
58
|
+
expect(p2.start).to eql Time.new(2014, 6, 6, 20, 0, 0, '+02:00')
|
59
|
+
expect(p2.start).to eql Time.new(2014, 6, 6, 14, 0, 0, '-04:00')
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should end at 21:30 on friday" do
|
63
|
+
expect(p2.end).to eql Time.new(2014, 6, 6, 21, 30, 0, '+02:00')
|
64
|
+
expect(p2.end).to eql Time.new(2014, 6, 6, 15, 30, 0, '-04:00')
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context "practice 3" do
|
69
|
+
subject(:p3) { canadianGP.events[2] }
|
70
|
+
|
71
|
+
it "should be of type Practice" do
|
72
|
+
expect(p3.class).to eql Fonecal::Practice
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should start at 16:00 on saturday" do
|
76
|
+
expect(p3.start).to eql Time.new(2014, 6, 7, 16, 0, 0, '+02:00')
|
77
|
+
expect(p3.start).to eql Time.new(2014, 6, 7, 10, 0, 0, '-04:00')
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should end at 17:00 on saturday" do
|
81
|
+
expect(p3.end).to eql Time.new(2014, 6, 7, 17, 0, 0, '+02:00')
|
82
|
+
expect(p3.end).to eql Time.new(2014, 6, 7, 11, 0, 0, '-04:00')
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
context "qualifying" do
|
87
|
+
subject(:q) { canadianGP.events[3] }
|
88
|
+
|
89
|
+
it "should be of type Practice" do
|
90
|
+
expect(q.class).to eql Fonecal::Qualifying
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should start at 19:00 on saturday" do
|
94
|
+
expect(q.start).to eql Time.new(2014, 6, 7, 19, 0, 0, '+02:00')
|
95
|
+
expect(q.start).to eql Time.new(2014, 6, 7, 13, 0, 0, '-04:00')
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should end at 20:30 on saturday" do
|
99
|
+
expect(q.end).to eql Time.new(2014, 6, 7, 20, 30, 0, '+02:00')
|
100
|
+
expect(q.end).to eql Time.new(2014, 6, 7, 14, 30, 0, '-04:00')
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
context "race" do
|
105
|
+
subject(:race) { canadianGP.events[4] }
|
106
|
+
|
107
|
+
it "should be of type Practice" do
|
108
|
+
expect(race.class).to eql Fonecal::Race
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should start at 20:00 on sunday" do
|
112
|
+
expect(race.start).to eql Time.new(2014, 6, 8, 20, 0, 0, '+02:00')
|
113
|
+
expect(race.start).to eql Time.new(2014, 6, 8, 14, 0, 0, '-04:00')
|
114
|
+
end
|
115
|
+
|
116
|
+
it "should end at 24:00 on sunday" do
|
117
|
+
expect(race.end).to eql Time.new(2014, 6, 8, 24, 0, 0, '+02:00')
|
118
|
+
expect(race.end).to eql Time.new(2014, 6, 8, 18, 0, 0, '-04:00')
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
data/spec/fonecal_spec.rb
CHANGED
data/spec/grand_prix_spec.rb
CHANGED
@@ -1,31 +1,260 @@
|
|
1
1
|
require 'fonecal'
|
2
2
|
|
3
3
|
describe Fonecal::GrandPrix do
|
4
|
-
|
5
|
-
|
4
|
+
|
5
|
+
describe "Canadian GP" do
|
6
|
+
subject(:canadianGP) { Fonecal::GrandPrix.new('http://www.formula1.com/races/in_detail/canada_922/circuit_diagram.html') }
|
6
7
|
|
7
8
|
it "should have the correct race title" do
|
8
|
-
|
9
|
+
expect(canadianGP.raceTitle).to eql "Formula 1 Grand Prix Du Canada 2014"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should be in Canada" do
|
13
|
+
expect(canadianGP.country).to eql "Canada"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should be in Montreal" do
|
17
|
+
#expect(canadianGP.city).to eql "Montreal"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should be in the EST timezone" do
|
21
|
+
estTS = Timezone::Zone.new(zone: "EST")
|
22
|
+
montrealTS = Timezone::Zone.new(zone: "America/Montreal")
|
23
|
+
now = Time.now
|
24
|
+
|
25
|
+
#expect(canadianGP.timezone.time(now).to_i).to eq estTS.time(now).to_i
|
26
|
+
expect(canadianGP.timezone.time(now).to_i).to eq montrealTS.time(now).to_i
|
9
27
|
end
|
10
28
|
|
11
|
-
it "should
|
12
|
-
|
29
|
+
it "should have 5 events" do
|
30
|
+
expect(canadianGP.events.count).to eql 5
|
13
31
|
end
|
14
32
|
|
15
|
-
|
16
|
-
|
33
|
+
context "practice 1" do
|
34
|
+
subject(:p1) { canadianGP.events.first }
|
35
|
+
|
36
|
+
it "should be of type Practice" do
|
37
|
+
expect(p1.class).to eql Fonecal::Practice
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should start at 16:00 CET on friday" do
|
41
|
+
expect(p1.start).to eql Time.new(2014, 6, 6, 16, 0, 0, '+02:00')
|
42
|
+
expect(p1.start).to eql Time.new(2014, 6, 6, 10, 0, 0, '-04:00')
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should end at 17:30 CET on friday" do
|
46
|
+
expect(p1.end).to eql Time.new(2014, 6, 6, 17, 30, 0, '+02:00')
|
47
|
+
expect(p1.end).to eql Time.new(2014, 6, 6, 11, 30, 0, '-04:00')
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
context "practice 2" do
|
52
|
+
subject(:p2) { canadianGP.events[1] }
|
53
|
+
|
54
|
+
it "should be of type Practice" do
|
55
|
+
expect(p2.class).to eql Fonecal::Practice
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should start at 20:00 on friday" do
|
59
|
+
expect(p2.start).to eql Time.new(2014, 6, 6, 20, 0, 0, '+02:00')
|
60
|
+
expect(p2.start).to eql Time.new(2014, 6, 6, 14, 0, 0, '-04:00')
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should end at 21:30 on friday" do
|
64
|
+
expect(p2.end).to eql Time.new(2014, 6, 6, 21, 30, 0, '+02:00')
|
65
|
+
expect(p2.end).to eql Time.new(2014, 6, 6, 15, 30, 0, '-04:00')
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
context "practice 3" do
|
70
|
+
subject(:p3) { canadianGP.events[2] }
|
71
|
+
|
72
|
+
it "should be of type Practice" do
|
73
|
+
expect(p3.class).to eql Fonecal::Practice
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should start at 16:00 on saturday" do
|
77
|
+
expect(p3.start).to eql Time.new(2014, 6, 7, 16, 0, 0, '+02:00')
|
78
|
+
expect(p3.start).to eql Time.new(2014, 6, 7, 10, 0, 0, '-04:00')
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should end at 17:00 on saturday" do
|
82
|
+
expect(p3.end).to eql Time.new(2014, 6, 7, 17, 0, 0, '+02:00')
|
83
|
+
expect(p3.end).to eql Time.new(2014, 6, 7, 11, 0, 0, '-04:00')
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
context "qualifying" do
|
88
|
+
subject(:q) { canadianGP.events[3] }
|
89
|
+
|
90
|
+
it "should be of type Practice" do
|
91
|
+
expect(q.class).to eql Fonecal::Qualifying
|
92
|
+
end
|
93
|
+
|
94
|
+
it "should start at 19:00 on saturday" do
|
95
|
+
expect(q.start).to eql Time.new(2014, 6, 7, 19, 0, 0, '+02:00')
|
96
|
+
expect(q.start).to eql Time.new(2014, 6, 7, 13, 0, 0, '-04:00')
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should end at 20:30 on saturday" do
|
100
|
+
expect(q.end).to eql Time.new(2014, 6, 7, 20, 30, 0, '+02:00')
|
101
|
+
expect(q.end).to eql Time.new(2014, 6, 7, 14, 30, 0, '-04:00')
|
102
|
+
end
|
17
103
|
end
|
18
104
|
|
19
|
-
|
20
|
-
|
21
|
-
it "should have the right name" do
|
22
|
-
belgianGP.events.first.name.should eql "Practice 1"
|
23
|
-
end
|
105
|
+
context "race" do
|
106
|
+
subject(:race) { canadianGP.events[4] }
|
24
107
|
|
25
|
-
|
26
|
-
|
27
|
-
|
108
|
+
it "should be of type Practice" do
|
109
|
+
expect(race.class).to eql Fonecal::Race
|
110
|
+
end
|
111
|
+
|
112
|
+
it "should start at 20:00 on sunday" do
|
113
|
+
expect(race.start).to eql Time.new(2014, 6, 8, 20, 0, 0, '+02:00')
|
114
|
+
expect(race.start).to eql Time.new(2014, 6, 8, 14, 0, 0, '-04:00')
|
115
|
+
end
|
116
|
+
|
117
|
+
it "should end at 24:00 on sunday" do
|
118
|
+
expect(race.end).to eql Time.new(2014, 6, 8, 24, 0, 0, '+02:00')
|
119
|
+
expect(race.end).to eql Time.new(2014, 6, 8, 18, 0, 0, '-04:00')
|
28
120
|
end
|
29
121
|
end
|
30
122
|
end
|
123
|
+
|
124
|
+
#describe "Hungarian GP" do
|
125
|
+
# subject(:hungarianGP) { Fonecal::GrandPrix.new('http://www.formula1.com/races/in_detail/hungary_926/circuit_diagram.html') }
|
126
|
+
|
127
|
+
# it "should have the correct race title" do
|
128
|
+
# expect(hungarianGP.raceTitle).to eql "Formula 1 Pirelli Magyar Nagydíj 2014"
|
129
|
+
# end
|
130
|
+
|
131
|
+
# it "should be in Hungary" do
|
132
|
+
# expect(hungarianGP.country).to eql "Hungary"
|
133
|
+
# end
|
134
|
+
|
135
|
+
# it "should be in Budapest" do
|
136
|
+
# expect(hungarianGP.city).to eql "Budapest"
|
137
|
+
# end
|
138
|
+
|
139
|
+
# it "should be in the CET timezone" do
|
140
|
+
# cetTS = Timezone::Zone.new(zone: "CET")
|
141
|
+
# budapestTS = Timezone::Zone.new(zone: "Europe/Budapest")
|
142
|
+
|
143
|
+
# expect(hungarianGP.timezone.time(Time.now).to_i).to eq cetTS.time(Time.now).to_i
|
144
|
+
# expect(hungarianGP.timezone.time(Time.now).to_i).to eq budapestTS.time(Time.now).to_i
|
145
|
+
# end
|
146
|
+
|
147
|
+
# it "should have 5 events" do
|
148
|
+
# expect(hungarianGP.events.count).to eql 5
|
149
|
+
# end
|
150
|
+
|
151
|
+
# context "practice 1" do
|
152
|
+
# subject(:p1) { hungarianGP.events.first }
|
153
|
+
|
154
|
+
# it "should be of type Practice" do
|
155
|
+
# expect(p1.class).to eql Fonecal::Practice
|
156
|
+
# end
|
157
|
+
|
158
|
+
# it "should start at 10:00 on friday" do
|
159
|
+
# expect(p1.start).to eql Time.new(2014, 7, 25, 10, 0, 0, '+02:00')
|
160
|
+
# end
|
161
|
+
|
162
|
+
# it "should end at 11:30 on friday" do
|
163
|
+
# expect(p1.end).to eql Time.new(2014, 7, 25, 11, 30, 0, '+02:00')
|
164
|
+
# end
|
165
|
+
# end
|
166
|
+
|
167
|
+
# context "practice 2" do
|
168
|
+
# subject(:p2) { hungarianGP.events[1] }
|
169
|
+
|
170
|
+
# it "should be of type Practice" do
|
171
|
+
# expect(p2.class).to eql Fonecal::Practice
|
172
|
+
# end
|
173
|
+
|
174
|
+
# it "should start at 14:00 on friday" do
|
175
|
+
# expect(p2.start).to eql Time.new(2014, 7, 25, 14, 0, 0, '+02:00')
|
176
|
+
# end
|
177
|
+
|
178
|
+
# it "should end at 15:30 on friday" do
|
179
|
+
# expect(p2.end).to eql Time.new(2014, 7, 25, 15, 30, 0, '+02:00')
|
180
|
+
# end
|
181
|
+
# end
|
182
|
+
|
183
|
+
# context "practice 3" do
|
184
|
+
# subject(:p3) { hungarianGP.events[2] }
|
185
|
+
|
186
|
+
# it "should be of type Practice" do
|
187
|
+
# expect(p3.class).to eql Fonecal::Practice
|
188
|
+
# end
|
189
|
+
|
190
|
+
# it "should start at 10:00 on saturday" do
|
191
|
+
# expect(p3.start).to eql Time.new(2014, 7, 26, 11, 0, 0, '+02:00')
|
192
|
+
# end
|
193
|
+
|
194
|
+
# it "should end at 11:30 on saturday" do
|
195
|
+
# expect(p3.end).to eql Time.new(2014, 7, 26, 12, 0, 0, '+02:00')
|
196
|
+
# end
|
197
|
+
# end
|
198
|
+
#
|
199
|
+
# context "qualifying" do
|
200
|
+
# subject(:q) { hungarianGP.events[3] }
|
201
|
+
|
202
|
+
# it "should be of type Practice" do
|
203
|
+
# expect(q.class).to eql Fonecal::Qualifying
|
204
|
+
# end
|
205
|
+
|
206
|
+
# it "should start at 14:00 on saturday" do
|
207
|
+
# expect(q.start).to eql Time.new(2014, 7, 26, 14, 0, 0, '+02:00')
|
208
|
+
# end
|
209
|
+
|
210
|
+
# it "should end at 15:30 on saturday" do
|
211
|
+
# expect(q.end).to eql Time.new(2014, 7, 26, 15, 30, 0, '+02:00')
|
212
|
+
# end
|
213
|
+
# end
|
214
|
+
|
215
|
+
# context "race" do
|
216
|
+
# subject(:race) { hungarianGP.events[4] }
|
217
|
+
|
218
|
+
# it "should be of type Practice" do
|
219
|
+
# expect(race.class).to eql Fonecal::Race
|
220
|
+
# end
|
221
|
+
|
222
|
+
# it "should start at 14:00 on sunday" do
|
223
|
+
# expect(race.start).to eql Time.new(2014, 7, 27, 14, 0, 0, '+02:00')
|
224
|
+
# end
|
225
|
+
|
226
|
+
# it "should end at 18:00 on sunday" do
|
227
|
+
# expect(race.end).to eql Time.new(2014, 7, 27, 18, 0, 0, '+02:00')
|
228
|
+
# end
|
229
|
+
# end
|
230
|
+
#end
|
231
|
+
|
232
|
+
|
233
|
+
#describe "Getting Belgian GP info" do
|
234
|
+
# let(:belgianGP) { Fonecal::GrandPrix.new("http://www.formula1.com/races/in_detail/belgium_927/circuit_diagram.html") }
|
235
|
+
|
236
|
+
# it "should have the correct race title" do
|
237
|
+
# belgianGP.raceTitle.should eql "2014 Formula 1 Shell Belgian Grand Prix"
|
238
|
+
# end
|
239
|
+
|
240
|
+
# it "should get a country" do
|
241
|
+
# belgianGP.country.should eql "Belgium"
|
242
|
+
# end
|
243
|
+
|
244
|
+
# it "has location object" do
|
245
|
+
# belgianGP.location.should_not be_nil
|
246
|
+
# end
|
247
|
+
|
248
|
+
# describe "its events" do
|
249
|
+
# describe "Practice 1" do
|
250
|
+
# it "should have the right name" do
|
251
|
+
# belgianGP.events.first.name.should eql "Practice 1"
|
252
|
+
# end
|
253
|
+
|
254
|
+
# it "should have the correct start time" do
|
255
|
+
# belgianGP.events.first.start.should eql Time.new(2014, 8, 22, 10, 0, 0, '+02:00')
|
256
|
+
# end
|
257
|
+
# end
|
258
|
+
# end
|
259
|
+
#end
|
31
260
|
end
|