thetvdb_party 0.0.12.pre → 0.0.13.pre

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.
@@ -1,21 +1,375 @@
1
1
  require 'rspec'
2
2
  require 'thetvdb_party'
3
3
 
4
- describe 'BaseSeriesRecord' do
5
- before(:each) do
6
- @valid_record = TheTvDbParty::BaseSeriesRecord.new(nil,
7
- {
8
- "id" => "0"
9
- }
10
- )
11
- @invalid_record = TheTvDbParty::BaseSeriesRecord.new(nil, { })
4
+ describe 'TheTvDbParty::BaseSeriesRecord' do
5
+ it 'should have a client associated with it' do
6
+ client = TheTvDbParty::Client.new
7
+ record = TheTvDbParty::BaseSeriesRecord.new client, { }
8
+ expect(record.client).to be_a(TheTvDbParty::Client)
12
9
  end
13
10
 
14
- it "should have valid id if valid" do
15
- expect @valid_record.seriesid == 0
11
+ it 'should have a nil client if constructed with nil' do
12
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { }
13
+ expect(record.client).to be_nil
16
14
  end
17
15
 
18
- it "should have negative id if series not found or invalid" do
19
- expect @invalid_record.seriesid < 0
16
+ it 'should have an id' do
17
+ record = TheTvDbParty::BaseSeriesRecord.new(nil, { "id" => "82459" })
18
+ expect(record.seriesid).to be_a(Fixnum)
19
+ expect(record.seriesid).to eq(82459)
20
+ end
21
+
22
+ it 'should have a negative id, if invalid specified' do
23
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { "id" => "INVALID_ID" }
24
+ expect(record.seriesid).to be_a(Fixnum)
25
+ expect(record.seriesid).to be < 0
26
+ end
27
+
28
+ it 'should have a negative id, if not specified' do
29
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { }
30
+ expect(record.seriesid).to be_a(Fixnum)
31
+ expect(record.seriesid).to be < 0
32
+ end
33
+
34
+ it 'should have a single element array for the actors, if only one name is specified' do
35
+ record = TheTvDbParty::BaseSeriesRecord.new(nil, { "Actors" => "Simon Baker" })
36
+ expect(record.actors).to match_array(["Simon Baker"])
37
+ end
38
+
39
+ it 'should have a multi element array for the actors, if a pipe-delimited list is specified' do
40
+ record = TheTvDbParty::BaseSeriesRecord.new(nil, { "Actors" => "Simon Baker|Robin Tunney|Amanda Righetti|Owain Yeoman|Tim Kang|Emily Swallow|Rockmond Dunbar|Michael Gaston|Pruitt Taylor Vince|Aunjanue Ellis|Gregory Itzin|Terry Kinney|Joe Adler|Josie Loren" })
41
+ expect(record.actors).to match_array(["Simon Baker", "Robin Tunney", "Amanda Righetti", "Owain Yeoman", "Tim Kang", "Emily Swallow", "Rockmond Dunbar", "Michael Gaston", "Pruitt Taylor Vince", "Aunjanue Ellis", "Gregory Itzin", "Terry Kinney", "Joe Adler", "Josie Loren"])
42
+ end
43
+
44
+ it 'should have a multi element array for the actors, if a pipe-surrounded list is specified' do
45
+ record = TheTvDbParty::BaseSeriesRecord.new(nil, { "Actors" => "|Simon Baker|Robin Tunney|Amanda Righetti|Owain Yeoman|Tim Kang|Emily Swallow|Rockmond Dunbar|Michael Gaston|Pruitt Taylor Vince|Aunjanue Ellis|Gregory Itzin|Terry Kinney|Joe Adler|Josie Loren|" })
46
+ expect(record.actors).to match_array(["Simon Baker", "Robin Tunney", "Amanda Righetti", "Owain Yeoman", "Tim Kang", "Emily Swallow", "Rockmond Dunbar", "Michael Gaston", "Pruitt Taylor Vince", "Aunjanue Ellis", "Gregory Itzin", "Terry Kinney", "Joe Adler", "Josie Loren"])
47
+ end
48
+
49
+ it 'should have an empty array for the actors, if none is specified' do
50
+ record = TheTvDbParty::BaseSeriesRecord.new(nil, { })
51
+ expect(record.actors).to be_empty
52
+ end
53
+
54
+ it 'should have the airs on day of week information' do
55
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { "Airs_DayOfWeek" => "Wednesday" }
56
+ expect(record.airs_dayofweek).to be_a(String)
57
+ expect(record.airs_dayofweek).to eq("Wednesday")
58
+ end
59
+
60
+ it 'should have a nil airs day of week, if not specified' do
61
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { }
62
+ expect(record.airs_dayofweek).to be_nil
63
+ end
64
+
65
+ it 'should have an airing time' do
66
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { "Airs_Time" => "8:00 PM" }
67
+ expect(record.airs_time).to be_a(Time)
68
+ reference_time = Time.new(2015, 1, 1, 20, 0, 0)
69
+ expect(record.airs_time.hour).to eq(reference_time.hour)
70
+ expect(record.airs_time.min).to eq(reference_time.min)
71
+ end
72
+
73
+ it 'should have a nil airing time, if invalid specified' do
74
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { "Airs_Time" => "INVALID_AIRS_TIME" }
75
+ expect(record.airs_time).to be_nil
76
+ end
77
+
78
+ it 'should have a nil airing time, if not specified' do
79
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { }
80
+ expect(record.airs_time).to be_nil
81
+ end
82
+
83
+ it 'should have a content rating' do
84
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { "ContentRating" => "TV-14" }
85
+ expect(record.contentrating).to be_a String
86
+ expect(record.contentrating).to eq "TV-14"
87
+ end
88
+
89
+ it 'should have a nil content rating, if not specified' do
90
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { }
91
+ expect(record.contentrating).to be_nil
92
+ end
93
+
94
+ it 'should have a first aired date' do
95
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { "FirstAired" => "2008-09-23" }
96
+ expect(record.firstaired).to be_a Date
97
+ expect(record.firstaired).to eq Date.new(2008, 9, 23)
98
+ end
99
+
100
+ it 'should have a nil first aired date, id invalid specified' do
101
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { "FirstAired" => "INVALID_FIRSTAIRED" }
102
+ expect(record.firstaired).to be_nil
103
+ end
104
+
105
+ it 'should have a nil first aired date, if none specified' do
106
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { }
107
+ expect(record.firstaired).to be_nil
108
+ end
109
+
110
+ it 'should have a single element array for the genre, if only one is specified' do
111
+ record = TheTvDbParty::BaseSeriesRecord.new(nil, { "Genre" => "Crime" })
112
+ expect(record.genres).to match_array(["Crime"])
113
+ end
114
+
115
+ it 'should have a multi element array for the genre, if a pipe-delimited list is specified' do
116
+ record = TheTvDbParty::BaseSeriesRecord.new(nil, { "Genre" => "Crime|Drama|Mystery" })
117
+ expect(record.genres).to match_array(["Crime", "Drama", "Mystery"])
118
+ end
119
+
120
+ it 'should have a multi element array for the genre, if a pipe-surrounded list is specified' do
121
+ record = TheTvDbParty::BaseSeriesRecord.new(nil, { "Genre" => "|Crime|Drama|Mystery|" })
122
+ expect(record.genres).to match_array(["Crime", "Drama", "Mystery"])
123
+ end
124
+
125
+ it 'should have an empty array for genre, if none is specified' do
126
+ record = TheTvDbParty::BaseSeriesRecord.new(nil, { })
127
+ expect(record.genres).to be_empty
128
+ end
129
+
130
+ it 'should have an IMDB id' do
131
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { "IMDB_ID" => "tt1196946" }
132
+ expect(record.imdb_id).to be_a String
133
+ expect(record.imdb_id).to eq "tt1196946"
134
+ end
135
+
136
+ it 'should have a nil IMDB id, if none is specified' do
137
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { }
138
+ expect(record.imdb_id).to be_nil
139
+ end
140
+
141
+ it 'should have a language associated with the record' do
142
+ record = TheTvDbParty::BaseSeriesRecord.new(nil, {"Language" => "en"})
143
+ expect(record.language).to be_a(String)
144
+ expect(record.language).to eq("en")
145
+ end
146
+
147
+ it 'should have a nil language associated with the record, if not specified' do
148
+ record = TheTvDbParty::BaseSeriesRecord.new(nil, {})
149
+ expect(record.language).to be_nil
150
+ end
151
+
152
+ it 'should have a network' do
153
+ record = TheTvDbParty::BaseSeriesRecord.new(nil, {"Network" => "CBS"})
154
+ expect(record.network).to be_a String
155
+ expect(record.network).to eq "CBS"
156
+ end
157
+
158
+ it 'should have a nil network, if not specified' do
159
+ record = TheTvDbParty::BaseSeriesRecord.new(nil, {})
160
+ expect(record.network).to be_nil
161
+ end
162
+
163
+ it 'should have a network id' do
164
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { "NetworkID" => "123456" }
165
+ expect(record.networkid).to be_a Fixnum
166
+ expect(record.networkid).to eq 123456
167
+ end
168
+
169
+ it 'should have a negative network id, if none is specified' do
170
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { }
171
+ expect(record.networkid).to be_nil
172
+ end
173
+
174
+ it 'should have an overview' do
175
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { "Overview" => "SAMPLE_OVERVIEW" }
176
+ expect(record.overview).to be_a String
177
+ expect(record.overview).to eq "SAMPLE_OVERVIEW"
178
+ end
179
+
180
+ it 'should have a rating' do
181
+ record = TheTvDbParty::BaseSeriesRecord.new(nil, { "Rating" => "6.6667" })
182
+ expect(record.rating).to be_an_instance_of(Float)
183
+ expect(record.rating).to be >= 0.0
184
+ expect(record.rating).to be 6.6667
185
+ end
186
+
187
+ it 'should have a zero rating, if invalid specified' do
188
+ record = TheTvDbParty::BaseSeriesRecord.new(nil, { "Rating" => "INVALID_RATING" })
189
+ expect(record.rating).to be_an_instance_of(Float)
190
+ expect(record.rating).to be 0.0
191
+ end
192
+
193
+ it 'should have a zero rating, if it is not specified' do
194
+ record = TheTvDbParty::BaseSeriesRecord.new(nil, { })
195
+ expect(record.rating).to be_an_instance_of(Float)
196
+ expect(record.rating).to be 0.0
197
+ end
198
+
199
+ it 'should have a rating count' do
200
+ record = TheTvDbParty::BaseSeriesRecord.new(nil, { "RatingCount" => "6" })
201
+ expect(record.ratingcount).to be_an_instance_of(Fixnum)
202
+ expect(record.ratingcount).to be >= 0
203
+ expect(record.ratingcount).to eq(6)
204
+ end
205
+
206
+ it 'should have a zero rating count, if invalid specified' do
207
+ record = TheTvDbParty::BaseSeriesRecord.new(nil, { "RatingCount" => "INVALID_RATINGCOUNT" })
208
+ expect(record.ratingcount).to be_an_instance_of(Fixnum)
209
+ expect(record.ratingcount).to be 0
210
+ end
211
+
212
+ it 'should have a zero rating count, if it is not specified' do
213
+ record = TheTvDbParty::BaseSeriesRecord.new(nil, { })
214
+ expect(record.ratingcount).to be_an_instance_of(Fixnum)
215
+ expect(record.ratingcount).to be 0
216
+ end
217
+
218
+ it 'should have runtime' do
219
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { "Runtime" => "60" }
220
+ expect(record.runtime).to be_a Fixnum
221
+ expect(record.runtime).to eq 60
222
+ end
223
+
224
+ it 'should have a negative runtime, if invalid specified' do
225
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { "Runtime" => "INVALID_RUNTIME" }
226
+ expect(record.runtime).to be_a Fixnum
227
+ expect(record.runtime).to be < 0
228
+ end
229
+
230
+ it 'should have a negative runtime, if none is specified' do
231
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { }
232
+ expect(record.runtime).to be_a Fixnum
233
+ expect(record.runtime).to be < 0
234
+ end
235
+
236
+ it 'should have a TV.com id' do
237
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { "SeriesID" => "75200" }
238
+ expect(record.tvcom_id).to be_a Fixnum
239
+ expect(record.tvcom_id).to eq 75200
240
+ end
241
+
242
+ it 'should have a nil TV.com id, if none is spcified' do
243
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { }
244
+ expect(record.tvcom_id).to be_nil
245
+ end
246
+
247
+ it 'should have a series name' do
248
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { "SeriesName" => "The Mentalist" }
249
+ expect(record.seriesname).to be_a String
250
+ expect(record.seriesname).to eq "The Mentalist"
251
+ end
252
+
253
+ it 'should have a nil series name, if none is spcified' do
254
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { }
255
+ expect(record.seriesname).to be_nil
256
+ end
257
+
258
+ it 'should have a status' do
259
+ %w(Ended Continuing).each do |expected_valid_status|
260
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { "Status" => expected_valid_status }
261
+ expect(record.status).to be_a String
262
+ expect(record.status).to eq expected_valid_status
263
+ end
264
+ end
265
+
266
+ it 'should have a nil status, if an invalid one is specified' do
267
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { "Status" => "INVALID_STATUS" }
268
+ expect(record.status).to be_nil
269
+ end
270
+
271
+ it 'should have a nil status, if none is specified' do
272
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { }
273
+ expect(record.status).to be_nil
274
+ end
275
+
276
+ it 'should have an added timestamp' do
277
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { "added" => "2015-01-01 12:00:00" }
278
+ expect(record.added).to be_a DateTime
279
+ expect(record.added).to eq DateTime.new(2015, 1, 1, 12, 0, 0)
280
+ end
281
+
282
+ it 'should have a nil added timestamp, if an invalid time was specified' do
283
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { "added" => "INVALID_ADDED" }
284
+ expect(record.added).to be_nil
285
+ end
286
+
287
+ it 'should have a nil added timestamp, if none is specified' do
288
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { }
289
+ expect(record.added).to be_nil
290
+ end
291
+
292
+ it 'should have an added by field' do
293
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { "addedBy" => "123456" }
294
+ expect(record.addedby).to be_a Fixnum
295
+ expect(record.addedby).to eq 123456
296
+ end
297
+
298
+ it 'should have a nil added by field, if an invalid account is specified' do
299
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { "addedBy" => "INVALID_ADDEDBY" }
300
+ expect(record.addedby).to be_nil
301
+ end
302
+
303
+ it 'should have a nil added by field, if none is specified' do
304
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { }
305
+ expect(record.addedby).to be_nil
306
+ end
307
+
308
+ it 'should have a relative/full banner path' do
309
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { "banner" => "graphical/82459-g4.jpg" }
310
+ expect(record.bannerpath_relative).to be_a String
311
+ expect(record.bannerpath_full).to be_a URI::Generic
312
+ expect(record.bannerpath_relative).to eq "graphical/82459-g4.jpg"
313
+ expect(record.bannerpath_full).to eq URI::join(TheTvDbParty::BASE_URL, 'banners/', "graphical/82459-g4.jpg")
314
+ end
315
+
316
+ it 'should have a nil relative/full bannerpath, if none is specified' do
317
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { }
318
+ expect(record.bannerpath_relative).to be_nil
319
+ expect(record.bannerpath_full).to be_nil
320
+ end
321
+
322
+ it 'should have a relative/full fanart path' do
323
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { "fanart" => "fanart/original/82459-18.jpg" }
324
+ expect(record.fanartpath_relative).to be_a String
325
+ expect(record.fanartpath_full).to be_a URI::Generic
326
+ expect(record.fanartpath_relative).to eq "fanart/original/82459-18.jpg"
327
+ expect(record.fanartpath_full).to eq URI::join(TheTvDbParty::BASE_URL, 'banners/', "fanart/original/82459-18.jpg")
328
+ end
329
+
330
+ it 'should have a nil relative/full fanart, if none is specified' do
331
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { }
332
+ expect(record.fanartpath_relative).to be_nil
333
+ expect(record.fanartpath_full).to be_nil
334
+ end
335
+
336
+ it 'should have a last updated timestamp' do
337
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { "lastupdated" => "1424815167" }
338
+ expect(record.lastupdated).to be_a DateTime
339
+ expect(record.lastupdated).to eq Time.at(1424815167).to_datetime
340
+ end
341
+
342
+ it 'should have a nil last updated timestamp, if an invalid time is specified' do
343
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { "lastupdated" => "INVALID_LASTUPDATED" }
344
+ expect(record.lastupdated).to be_nil
345
+ end
346
+
347
+ it 'should have a nil last updated timestamp, if none is specified' do
348
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { }
349
+ expect(record.lastupdated).to be_nil
350
+ end
351
+
352
+ it 'should have a relative/full poster path' do
353
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { "poster" => "posters/82459-6.jpg" }
354
+ expect(record.posterpath_relative).to be_a String
355
+ expect(record.posterpath_full).to be_a URI::Generic
356
+ expect(record.posterpath_relative).to eq "posters/82459-6.jpg"
357
+ expect(record.posterpath_full).to eq URI::join(TheTvDbParty::BASE_URL, 'banners/', "posters/82459-6.jpg")
358
+ end
359
+
360
+ it 'should have a nil relative/full poster, if none is specified' do
361
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { }
362
+ expect(record.posterpath_relative).to be_nil
363
+ expect(record.posterpath_full).to be_nil
364
+ end
365
+
366
+ it 'should have a zap2it id' do
367
+ record = TheTvDbParty::BaseSeriesRecord.new nil, { "zap2it_id" => "EP01058714" }
368
+ expect(record.zap2it_id).to be_a String
369
+ expect(record.zap2it_id).to eq "EP01058714"
370
+ end
371
+
372
+ it 'should not instantiate when created without hash values' do
373
+ expect { TheTvDbParty::BaseSeriesRecord.new(nil, nil) }.to raise_error
20
374
  end
21
375
  end
@@ -0,0 +1,27 @@
1
+ require 'rspec'
2
+ require 'thetvdb_party'
3
+
4
+ describe 'TheTvDbParty::Client' do
5
+
6
+ it 'should have an api key' do
7
+ client = TheTvDbParty::Client.new "123456789"
8
+ expect(client.apikey).to be_a String
9
+ end
10
+
11
+ it 'should have a nil api key, if none is spcified' do
12
+ client = TheTvDbParty::Client.new
13
+ expect(client.apikey).to be_nil
14
+ end
15
+
16
+ it 'should have a language associated with it' do
17
+ client = TheTvDbParty::Client.new
18
+ client.language = "en"
19
+ expect(client.language).to be_a String
20
+ expect(client.language).to eq "en"
21
+ end
22
+
23
+ it 'should have a nil language, if none is specified' do
24
+ client = TheTvDbParty::Client.new
25
+ expect(client.language).to be_nil
26
+ end
27
+ end
@@ -0,0 +1,138 @@
1
+ require 'rspec'
2
+ require 'thetvdb_party'
3
+
4
+ describe 'TheTvDbParty::SearchSeriesRecord' do
5
+
6
+ it 'should have a client associated with it' do
7
+ record = TheTvDbParty::SearchSeriesRecord.new TheTvDbParty::Client.new, { }
8
+ expect(record.client).to be_a TheTvDbParty::Client
9
+ end
10
+
11
+ it 'should have a nil client, if constructed with nil' do
12
+ record = TheTvDbParty::SearchSeriesRecord.new nil, { }
13
+ expect(record.client).to be_nil
14
+ end
15
+
16
+ it 'should have a series id' do
17
+ record = TheTvDbParty::SearchSeriesRecord.new nil, { "seriesid" => "82459" }
18
+ expect(record.seriesid).to be_a Fixnum
19
+ expect(record.seriesid).to eq 82459
20
+ end
21
+
22
+ it 'should have a negative series id, if an invalid id is specified' do
23
+ record = TheTvDbParty::SearchSeriesRecord.new nil, { "seriesid" => "INVALID_SERIESID" }
24
+ expect(record.seriesid).to be_a Fixnum
25
+ expect(record.seriesid).to be < 0
26
+ end
27
+
28
+ it 'should have a negative series id, if none is specified' do
29
+ record = TheTvDbParty::SearchSeriesRecord.new nil, { }
30
+ expect(record.seriesid).to be_a Fixnum
31
+ expect(record.seriesid).to be < 0
32
+ end
33
+
34
+ it 'should have a language' do
35
+ record = TheTvDbParty::SearchSeriesRecord.new nil, { "language" => "en" }
36
+ expect(record.language).to be_a String
37
+ expect(record.language).to eq "en"
38
+ end
39
+
40
+ it 'should have a nil language, if none is specified' do
41
+ record = TheTvDbParty::SearchSeriesRecord.new nil, { }
42
+ expect(record.language).to be_nil
43
+ end
44
+
45
+ it 'should have a series name' do
46
+ record = TheTvDbParty::SearchSeriesRecord.new nil, { "SeriesName" => "The Mentalist" }
47
+ expect(record.seriesname).to be_a String
48
+ expect(record.seriesname).to eq "The Mentalist"
49
+ end
50
+
51
+ it 'should have a single element array for the aliases, if only one is specified' do
52
+ record = TheTvDbParty::SearchSeriesRecord.new(nil, { "AliasNames" => "Star Trek: The Original Series" })
53
+ expect(record.aliasnames).to match_array(["Star Trek: The Original Series"])
54
+ end
55
+
56
+ it 'should have a multi element array for the aliases, if a pipe-delimited list is specified' do
57
+ record = TheTvDbParty::SearchSeriesRecord.new(nil, { "AliasNames" => "Star Trek: The Original Series|Star Trek: TOS" })
58
+ expect(record.aliasnames).to match_array(["Star Trek: The Original Series", "Star Trek: TOS"])
59
+ end
60
+
61
+ it 'should have a multi element array for the aliases, if a pipe-surrounded list is specified' do
62
+ record = TheTvDbParty::SearchSeriesRecord.new(nil, { "AliasNames" => "|Star Trek: The Original Series|Star Trek: TOS|" })
63
+ expect(record.aliasnames).to match_array(["Star Trek: The Original Series", "Star Trek: TOS"])
64
+ end
65
+
66
+ it 'should have an empty array for the aliases, if none is specified' do
67
+ record = TheTvDbParty::SearchSeriesRecord.new(nil, { })
68
+ expect(record.aliasnames).to be_empty
69
+ end
70
+
71
+ it 'should have a relative/full banner path' do
72
+ record = TheTvDbParty::SearchSeriesRecord.new nil, { "banner" => "graphical/82459-g4.jpg" }
73
+ expect(record.bannerpath_relative).to be_a String
74
+ expect(record.bannerpath_full).to be_a URI::Generic
75
+ expect(record.bannerpath_relative).to eq "graphical/82459-g4.jpg"
76
+ expect(record.bannerpath_full).to eq URI::join(TheTvDbParty::BASE_URL, 'banners/', "graphical/82459-g4.jpg")
77
+ end
78
+
79
+ it 'should have a nil relative/full bannerpath, if none is specified' do
80
+ record = TheTvDbParty::SearchSeriesRecord.new nil, { }
81
+ expect(record.bannerpath_relative).to be_nil
82
+ expect(record.bannerpath_full).to be_nil
83
+ end
84
+
85
+ it 'should have an overview' do
86
+ record = TheTvDbParty::SearchSeriesRecord.new nil, { "Overview" => "SAMPLE_OVERVIEW" }
87
+ expect(record.overview).to be_a String
88
+ expect(record.overview).to eq "SAMPLE_OVERVIEW"
89
+ end
90
+
91
+ it 'should have a first aired date' do
92
+ record = TheTvDbParty::SearchSeriesRecord.new nil, { "FirstAired" => "2008-09-23" }
93
+ expect(record.firstaired).to be_a Date
94
+ expect(record.firstaired).to eq Date.new(2008, 9, 23)
95
+ end
96
+
97
+ it 'should have a nil first aired date, id invalid specified' do
98
+ record = TheTvDbParty::SearchSeriesRecord.new nil, { "FirstAired" => "INVALID_FIRSTAIRED" }
99
+ expect(record.firstaired).to be_nil
100
+ end
101
+
102
+ it 'should have a nil first aired date, if none specified' do
103
+ record = TheTvDbParty::SearchSeriesRecord.new nil, { }
104
+ expect(record.firstaired).to be_nil
105
+ end
106
+
107
+ it 'should have an IMDB id' do
108
+ record = TheTvDbParty::SearchSeriesRecord.new nil, { "IMDB_ID" => "tt1196946" }
109
+ expect(record.imdb_id).to be_a String
110
+ expect(record.imdb_id).to eq "tt1196946"
111
+ end
112
+
113
+ it 'should have a nil IMDB id, if none is specified' do
114
+ record = TheTvDbParty::SearchSeriesRecord.new nil, { }
115
+ expect(record.imdb_id).to be_nil
116
+ end
117
+
118
+ it 'should have a zap2it id' do
119
+ record = TheTvDbParty::SearchSeriesRecord.new nil, { "zap2it_id" => "EP01058714" }
120
+ expect(record.zap2it_id).to be_a String
121
+ expect(record.zap2it_id).to eq "EP01058714"
122
+ end
123
+
124
+ it 'should have a network' do
125
+ record = TheTvDbParty::SearchSeriesRecord.new(nil, {"Network" => "CBS"})
126
+ expect(record.network).to be_a String
127
+ expect(record.network).to eq "CBS"
128
+ end
129
+
130
+ it 'should have a nil network, if not specified' do
131
+ record = TheTvDbParty::SearchSeriesRecord.new(nil, {})
132
+ expect(record.network).to be_nil
133
+ end
134
+
135
+ it 'should not instantiate when created without hash values' do
136
+ expect { TheTvDbParty::SearchSeriesRecord.new nil, nil }.to raise_error
137
+ end
138
+ end