spotlite 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +5 -5
- data/Rakefile +1 -1
- data/lib/spotlite.rb +2 -1
- data/lib/spotlite/http_client.rb +18 -0
- data/lib/spotlite/movie.rb +92 -83
- data/lib/spotlite/person.rb +32 -34
- data/lib/spotlite/string_extensions.rb +13 -13
- data/lib/spotlite/version.rb +1 -1
- data/spec/fixtures/movie_find_conan +248 -213
- data/spec/fixtures/movie_find_no_results +246 -212
- data/spec/fixtures/nm0000233/index +2139 -1374
- data/spec/fixtures/nm0005132/index +1081 -698
- data/spec/fixtures/nm0864666/index +393 -329
- data/spec/fixtures/nm1659547/index +1065 -686
- data/spec/fixtures/person_find_conan +247 -212
- data/spec/fixtures/person_find_no_results +246 -212
- data/spec/fixtures/search_name_count_50 +178 -180
- data/spec/fixtures/search_title_count_50 +251 -251
- data/spec/fixtures/tt0002186/index +2439 -492
- data/spec/fixtures/tt0047396/releaseinfo +583 -411
- data/spec/fixtures/tt0112873/index +1157 -864
- data/spec/fixtures/tt0120338/technical +353 -283
- data/spec/fixtures/tt0133093/criticreviews +329 -269
- data/spec/fixtures/tt0133093/fullcredits +1610 -893
- data/spec/fixtures/tt0133093/index +1360 -949
- data/spec/fixtures/tt0133093/keywords +5134 -1015
- data/spec/fixtures/tt0133093/mediaindex_still_frame +323 -250
- data/spec/fixtures/tt0133093/releaseinfo +579 -410
- data/spec/fixtures/tt0133093/trivia +1974 -1447
- data/spec/fixtures/tt0169547/index +1296 -901
- data/spec/fixtures/tt0317248/index +1308 -888
- data/spec/fixtures/tt1134629/fullcredits +1022 -598
- data/spec/spec_helper.rb +4 -4
- data/spec/spotlite/find_spec.rb +3 -3
- data/spec/spotlite/movie_spec.rb +48 -51
- data/spec/spotlite/person_spec.rb +25 -25
- data/spotlite.gemspec +3 -1
- metadata +32 -3
data/spec/spec_helper.rb
CHANGED
@@ -25,11 +25,11 @@ IMDB_SAMPLES = {
|
|
25
25
|
'http://www.imdb.com/title/tt0002186/' => 'tt0002186/index',
|
26
26
|
'http://www.imdb.com/title/tt1134629/fullcredits' => 'tt1134629/fullcredits',
|
27
27
|
'http://www.imdb.com/find?q=conan&s=tt&ttype=ft' => 'movie_find_conan',
|
28
|
-
'http://www.imdb.com/find?q=wappadoozle
|
29
|
-
'http://www.imdb.com/find?q=herpinson
|
28
|
+
'http://www.imdb.com/find?q=wappadoozle%20swambling&s=tt&ttype=ft' => 'movie_find_no_results',
|
29
|
+
'http://www.imdb.com/find?q=herpinson%20derpington&s=nm' => 'person_find_no_results',
|
30
30
|
'http://www.imdb.com/find?q=conan&s=nm' => 'person_find_conan',
|
31
|
-
'http://www.imdb.com/search/title?count=50&title_type=feature&view=simple&start=1&sort=moviemeter
|
32
|
-
'http://www.imdb.com/search/name?count=50&view=simple&start=1&gender=male
|
31
|
+
'http://www.imdb.com/search/title?count=50&title_type=feature&view=simple&start=1&sort=moviemeter%2Casc' => 'search_title_count_50',
|
32
|
+
'http://www.imdb.com/search/name?count=50&view=simple&start=1&gender=male%2Cfemale&sort=starmeter%2Casc' => 'search_name_count_50',
|
33
33
|
'http://www.imdb.com/name/nm0000233/?nmdp=1' => 'nm0000233/index',
|
34
34
|
'http://www.imdb.com/name/nm0005132/?nmdp=1' => 'nm0005132/index',
|
35
35
|
'http://www.imdb.com/name/nm1659547/?nmdp=1' => 'nm1659547/index',
|
data/spec/spotlite/find_spec.rb
CHANGED
@@ -11,14 +11,14 @@ describe "Find feature" do
|
|
11
11
|
first.title.should eql("Conan the Barbarian")
|
12
12
|
first.year.should eql(2011)
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
it "should return emtpy array with no results" do
|
16
16
|
results = Spotlite::Movie.find("wappadoozle swambling")
|
17
17
|
results.should be_an(Array)
|
18
18
|
results.should be_empty
|
19
19
|
end
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
context "Person" do
|
23
23
|
it "should find people" do
|
24
24
|
results = Spotlite::Person.find("conan")
|
@@ -28,7 +28,7 @@ describe "Find feature" do
|
|
28
28
|
first.imdb_id.should eql("0000192")
|
29
29
|
first.name.should eql("Alyssa Milano")
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
it "should return emtpy array with no results" do
|
33
33
|
results = Spotlite::Person.find("herpinson derpington")
|
34
34
|
results.should be_an(Array)
|
data/spec/spotlite/movie_spec.rb
CHANGED
@@ -1,133 +1,129 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe "Spotlite::Movie" do
|
4
|
-
|
4
|
+
|
5
5
|
describe "valid movie" do
|
6
|
-
|
6
|
+
|
7
7
|
before(:each) do
|
8
8
|
# The Matrix (1999)
|
9
9
|
@movie = Spotlite::Movie.new("0133093")
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
it "should return title" do
|
13
13
|
@movie.title.should eql("The Matrix")
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
describe "original title" do
|
17
17
|
it "should return original title if it exists" do
|
18
18
|
# City of God (2002)
|
19
19
|
@movie = Spotlite::Movie.new("0317248")
|
20
20
|
@movie.original_title.should eql("Cidade de Deus")
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
it "should return nil if it doesn't exist" do
|
24
24
|
@movie.original_title.should be_nil
|
25
25
|
end
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
it "should return alternative titles" do
|
29
29
|
@movie.alternative_titles.should be_an(Array)
|
30
|
-
@movie.alternative_titles.size.should
|
31
|
-
@movie.alternative_titles.should include({:title => "The Matrix", :comment => "(original title)"})
|
30
|
+
@movie.alternative_titles.size.should be_within(10).of(40)
|
32
31
|
@movie.alternative_titles.should include({:title => "Maatriks", :comment => "Estonia"})
|
33
32
|
@movie.alternative_titles.should include({:title => "Матрица", :comment => "Russia"})
|
34
33
|
end
|
35
|
-
|
34
|
+
|
36
35
|
it "should return original release year" do
|
37
36
|
@movie.year.should eql(1999)
|
38
37
|
end
|
39
|
-
|
38
|
+
|
40
39
|
it "should return IMDb rating" do
|
41
40
|
@movie.rating.should eql(8.7)
|
42
41
|
end
|
43
|
-
|
42
|
+
|
44
43
|
it "should return number of votes" do
|
45
44
|
@movie.votes.should be_within(150000).of(900000)
|
46
45
|
end
|
47
|
-
|
46
|
+
|
48
47
|
it "should return Metascore rating" do
|
49
48
|
@movie.metascore.should eql(73)
|
50
49
|
end
|
51
|
-
|
50
|
+
|
52
51
|
it "should return description" do
|
53
52
|
# A Story about Love (1995)
|
54
53
|
@movie = Spotlite::Movie.new("0112873")
|
55
54
|
@movie.description.should eql("Two young people stand on a street corner in a run-down part of New York, kissing. Despite the lawlessness of the district they are left unmolested. A short distance away walk Maria and ...")
|
56
55
|
end
|
57
|
-
|
56
|
+
|
58
57
|
it "should return storyline" do
|
59
58
|
@movie.storyline.should eql("Thomas A. Anderson is a man living two lives. By day he is an average computer programmer and by night a hacker known as Neo. Neo has always questioned his reality, but the truth is far beyond his imagination. Neo finds himself targeted by the police when he is contacted by Morpheus, a legendary computer hacker branded a terrorist by the government. Morpheus awakens Neo to the real world, a ravaged wasteland where most of humanity have been captured by a race of machines that live off of the humans' body heat and electrochemical energy and who imprison their minds within an artificial reality known as the Matrix. As a rebel against the machines, Neo must return to the Matrix and confront the agents: super-powerful computer programs devoted to snuffing out Neo and the entire human rebellion.")
|
60
59
|
end
|
61
|
-
|
60
|
+
|
62
61
|
describe "content rating" do
|
63
62
|
it "should return MPAA content rating if it's given" do
|
64
63
|
@movie.content_rating.should eql("R")
|
65
64
|
end
|
66
|
-
|
65
|
+
|
67
66
|
it "should return nil if it's missing" do
|
68
67
|
# Rear Window (1954)
|
69
68
|
@movie = Spotlite::Movie.new("0047396")
|
70
69
|
@movie.content_rating.should be_nil
|
71
70
|
end
|
72
71
|
end
|
73
|
-
|
72
|
+
|
74
73
|
it "should return genres" do
|
75
74
|
@movie.genres.should be_an(Array)
|
76
75
|
@movie.genres.size.should eql(2)
|
77
76
|
@movie.genres.should include("Action")
|
78
77
|
@movie.genres.should include("Sci-Fi")
|
79
78
|
end
|
80
|
-
|
79
|
+
|
81
80
|
it "should return countries" do
|
82
81
|
@movie.countries.should be_an(Array)
|
83
82
|
@movie.countries.size.should eql(2)
|
84
83
|
@movie.countries.should include({:code => "us", :name => "USA"})
|
85
84
|
@movie.countries.should include({:code => "au", :name => "Australia"})
|
86
85
|
end
|
87
|
-
|
86
|
+
|
88
87
|
it "should return languages" do
|
89
88
|
@movie.languages.should be_an(Array)
|
90
89
|
@movie.languages.size.should eql(1)
|
91
90
|
@movie.languages.should include({:code => "en", :name => "English"})
|
92
91
|
end
|
93
|
-
|
92
|
+
|
94
93
|
it "should return runtime in minutes" do
|
95
94
|
@movie.runtime.should eql(136)
|
96
95
|
end
|
97
|
-
|
96
|
+
|
98
97
|
describe "poster URL" do
|
99
98
|
it "should return old style poster URL" do
|
100
99
|
@movie.poster_url.should eql("http://ia.media-imdb.com/images/M/MV5BMTkxNDYxOTA4M15BMl5BanBnXkFtZTgwNTk0NzQxMTE@.jpg")
|
101
100
|
end
|
102
|
-
|
101
|
+
|
103
102
|
it "should return new style poster URL" do
|
104
103
|
# American Beauty (1999)
|
105
104
|
@movie = Spotlite::Movie.new("0169547")
|
106
105
|
@movie.poster_url.should eql("http://ia.media-imdb.com/images/M/MV5BMjM4NTI5NzYyNV5BMl5BanBnXkFtZTgwNTkxNTYxMTE@.jpg")
|
107
106
|
end
|
108
|
-
|
107
|
+
|
109
108
|
it "should return nil if poster doesn't exist" do
|
110
109
|
# The Flying Circus (1912)
|
111
110
|
@movie = Spotlite::Movie.new("0002186")
|
112
111
|
@movie.poster_url.should be_nil
|
113
112
|
end
|
114
113
|
end
|
115
|
-
|
114
|
+
|
116
115
|
it "should return an array of recommended movies as an array of initialized objects of Movie class" do
|
117
116
|
@movie.recommended_movies.should be_an(Array)
|
118
117
|
@movie.recommended_movies.size.should eql(12)
|
119
118
|
@movie.recommended_movies.each {|movie| movie.should be_a(Spotlite::Movie)}
|
120
|
-
@movie.recommended_movies.first.imdb_id.should eql("0234215")
|
121
|
-
@movie.recommended_movies.first.title.should eql("The Matrix Reloaded")
|
122
|
-
@movie.recommended_movies.first.year.should eql(2003)
|
123
119
|
end
|
124
|
-
|
120
|
+
|
125
121
|
it "should return plot keywords" do
|
126
122
|
@movie.keywords.should be_an(Array)
|
127
123
|
@movie.keywords.size.should be_within(50).of(250)
|
128
124
|
@movie.keywords.should include("computer", "artificial reality", "hand to hand combat", "white rabbit", "chosen one")
|
129
125
|
end
|
130
|
-
|
126
|
+
|
131
127
|
it "should return trivia" do
|
132
128
|
@movie.trivia.should be_an(Array)
|
133
129
|
@movie.trivia.size.should be_within(10).of(100)
|
@@ -135,24 +131,24 @@ describe "Spotlite::Movie" do
|
|
135
131
|
@movie.trivia.should include("Carrie-Anne Moss twisted her ankle while shooting one of her scenes but decided not to tell anyone until after filming, so they wouldn't re-cast her.")
|
136
132
|
@movie.trivia.should include("Gary Oldman was considered as Morpheus at one point, as well as Samuel L. Jackson.")
|
137
133
|
end
|
138
|
-
|
134
|
+
|
139
135
|
describe "release dates" do
|
140
136
|
it "should return release dates" do
|
141
137
|
# Rear Window (1954)
|
142
138
|
@movie = Spotlite::Movie.new("0047396")
|
143
139
|
@movie.release_dates.should be_an(Array)
|
144
140
|
@movie.release_dates.size.should be_within(10).of(50)
|
145
|
-
@movie.release_dates.should include({:code => "us", :region => "USA", :date => Date.new(1954,8,
|
141
|
+
@movie.release_dates.should include({:code => "us", :region => "USA", :date => Date.new(1954,8,4), :comment => "New York City, New York, premiere"})
|
146
142
|
@movie.release_dates.should include({:code => "jp", :region => "Japan", :date => Date.new(1955,1,29), :comment => nil})
|
147
143
|
@movie.release_dates.should include({:code => "tr", :region => "Turkey", :date => Date.new(1956,4,1), :comment => nil})
|
148
144
|
@movie.release_dates.detect{ |r| r[:region] == "France" }.should eql({:code => "fr", :region => "France", :date => Date.new(1955,4,1), :comment => nil})
|
149
145
|
end
|
150
|
-
|
146
|
+
|
151
147
|
it "should return original release date" do
|
152
148
|
@movie.release_date.should eql(Date.new(1999,3,31))
|
153
149
|
end
|
154
150
|
end
|
155
|
-
|
151
|
+
|
156
152
|
it "should return critic reviews" do
|
157
153
|
@movie.critic_reviews.should be_an(Array)
|
158
154
|
@movie.critic_reviews.size.should be_within(5).of(15)
|
@@ -172,7 +168,7 @@ describe "Spotlite::Movie" do
|
|
172
168
|
:score => 75
|
173
169
|
}
|
174
170
|
)
|
175
|
-
|
171
|
+
|
176
172
|
@movie.critic_reviews.should include(
|
177
173
|
{
|
178
174
|
:source => "Los Angeles Times",
|
@@ -182,18 +178,19 @@ describe "Spotlite::Movie" do
|
|
182
178
|
}
|
183
179
|
)
|
184
180
|
end
|
185
|
-
|
181
|
+
|
186
182
|
it "should return technical information as a hash of arrays" do
|
183
|
+
# Titanic (1997)
|
187
184
|
@movie = Spotlite::Movie.new("0120338")
|
188
185
|
hash = @movie.technical
|
189
186
|
hash.should be_a(Hash)
|
190
187
|
hash.each{|element| element.should be_an(Array)}
|
191
188
|
hash.should include("Runtime" => ["3 hr 14 min (194 min)"])
|
192
|
-
hash.should include("Sound Mix" => ["
|
193
|
-
hash.should include("Cinematographic Process" => ["Super 35", "Techniscope (underwater scenes)"])
|
189
|
+
hash.should include("Sound Mix" => ["Dolby Digital (Dolby Digital 5.1) (5.1 Surround Sound) (L-R)", "DTS (DTS 5.1) (5.1 Surround Sound) (L-R)", "DTS 70 mm (70 mm prints) (5.1 Surround Sound) (L-R)", "SDDS (8 channels) (L-R)"])
|
190
|
+
hash.should include("Cinematographic Process" => ["Digital Intermediate (4k) (2012 re-release)", "Super 35", "Techniscope (underwater scenes)"])
|
194
191
|
hash.should include("Film Length" => ["5,340 m (Sweden)", "5,426 m (10 reels)"])
|
195
192
|
end
|
196
|
-
|
193
|
+
|
197
194
|
it "should return an array of still frames URLs" do
|
198
195
|
@movie.images.should be_an(Array)
|
199
196
|
@movie.images.size.should eql(12)
|
@@ -202,7 +199,7 @@ describe "Spotlite::Movie" do
|
|
202
199
|
"http://ia.media-imdb.com/images/M/MV5BMTAyMDc1MTU0MDBeQTJeQWpwZ15BbWU2MDI5MzU3Nw@@.jpg"
|
203
200
|
)
|
204
201
|
end
|
205
|
-
|
202
|
+
|
206
203
|
describe "movie credits" do
|
207
204
|
it "should return crew categories" do
|
208
205
|
@movie.crew_categories.should be_an(Array)
|
@@ -210,10 +207,10 @@ describe "Spotlite::Movie" do
|
|
210
207
|
@movie.crew_categories.should include("Directed by", "Writing Credits", "Cinematography by", "Second Unit Director or Assistant Director", "Casting By", "Other crew")
|
211
208
|
@movie.crew_categories.should_not include("Cast")
|
212
209
|
end
|
213
|
-
|
210
|
+
|
214
211
|
it "should return movie cast" do
|
215
212
|
@movie.cast.should be_an(Array)
|
216
|
-
@movie.cast.size.should
|
213
|
+
@movie.cast.size.should be_within(10).of(37)
|
217
214
|
@movie.cast.each{ |person| person.should be_a(Spotlite::Person) }
|
218
215
|
first = @movie.cast.first
|
219
216
|
first.name.should eql("Keanu Reeves")
|
@@ -221,19 +218,19 @@ describe "Spotlite::Movie" do
|
|
221
218
|
first.credits_category.should eql("Cast")
|
222
219
|
first.credits_text.should eql("Neo")
|
223
220
|
end
|
224
|
-
|
221
|
+
|
225
222
|
it "should return movie crew" do
|
226
223
|
@movie.crew.should be_an(Array)
|
227
|
-
@movie.crew.size.should
|
224
|
+
@movie.crew.size.should be_within(50).of(550)
|
228
225
|
@movie.crew.each{ |person| person.should be_a(Spotlite::Person) }
|
229
226
|
end
|
230
|
-
|
227
|
+
|
231
228
|
it "should return full credits" do
|
232
229
|
@movie.credits.should be_an(Array)
|
233
230
|
@movie.credits.size.should eql(@movie.cast.size + @movie.crew.size)
|
234
231
|
@movie.credits.each{ |person| person.should be_a(Spotlite::Person) }
|
235
232
|
end
|
236
|
-
|
233
|
+
|
237
234
|
it "should parse crew category" do
|
238
235
|
category = @movie.parse_crew("Transportation Department")
|
239
236
|
category.should be_an(Array)
|
@@ -244,7 +241,7 @@ describe "Spotlite::Movie" do
|
|
244
241
|
first.credits_category.should eql("Transportation Department")
|
245
242
|
first.credits_text.should eql("action vehicle coordinator")
|
246
243
|
end
|
247
|
-
|
244
|
+
|
248
245
|
it "should return starred actors" do
|
249
246
|
@movie.stars.should be_an(Array)
|
250
247
|
@movie.stars.size.should eql(3)
|
@@ -254,9 +251,9 @@ describe "Spotlite::Movie" do
|
|
254
251
|
first.imdb_id.should eql("0000206")
|
255
252
|
end
|
256
253
|
end
|
257
|
-
|
254
|
+
|
258
255
|
end
|
259
|
-
|
256
|
+
|
260
257
|
describe "#find method" do
|
261
258
|
it "should return some movies" do
|
262
259
|
results = Spotlite::Movie.find("conan")
|
@@ -267,14 +264,14 @@ describe "Spotlite::Movie" do
|
|
267
264
|
first.title.should eql("Conan the Barbarian")
|
268
265
|
first.imdb_id.should eql("0816462")
|
269
266
|
end
|
270
|
-
|
267
|
+
|
271
268
|
it "should return no results" do
|
272
269
|
results = Spotlite::Movie.find("wappadoozle swambling")
|
273
270
|
results.should be_an(Array)
|
274
271
|
results.size.should eql(0)
|
275
272
|
end
|
276
273
|
end
|
277
|
-
|
274
|
+
|
278
275
|
describe "#search method" do
|
279
276
|
it "should return some movies" do
|
280
277
|
results = Spotlite::Movie.search({count: 50})
|
@@ -283,5 +280,5 @@ describe "Spotlite::Movie" do
|
|
283
280
|
results.each{ |movie| movie.should be_a(Spotlite::Movie) }
|
284
281
|
end
|
285
282
|
end
|
286
|
-
|
283
|
+
|
287
284
|
end
|
@@ -1,73 +1,73 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe "Spotlite::Person" do
|
4
|
-
|
4
|
+
|
5
5
|
describe "valid person" do
|
6
|
-
|
6
|
+
|
7
7
|
before(:each) do
|
8
8
|
# Heath Ledger
|
9
9
|
@person = Spotlite::Person.new("0005132")
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
it "should return name" do
|
13
13
|
@person.name.should eql("Heath Ledger")
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
it "should return born name if present" do
|
17
17
|
@person.birth_name.should eql("Heath Andrew Ledger")
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
it "should return birth date" do
|
21
21
|
@person.birth_date.should be_a(Date)
|
22
22
|
@person.birth_date.should eql(Date.new(1979,4,4))
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
it "should return death date if present" do
|
26
26
|
@person.death_date.should be_a(Date)
|
27
27
|
@person.death_date.should eql(Date.new(2008,1,22))
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
describe "photo URL" do
|
31
31
|
it "should return old style photo URL" do
|
32
32
|
@person.photo_url.should eql("http://ia.media-imdb.com/images/M/MV5BMTI2NTY0NzA4MF5BMl5BanBnXkFtZTYwMjE1MDE0.jpg")
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
it "should return new style photo URL" do
|
36
36
|
# Carey Mulligan
|
37
37
|
@person = Spotlite::Person.new("1659547")
|
38
38
|
@person.photo_url.should eql("http://ia.media-imdb.com/images/M/MV5BMTQ2MTQyMzYzMV5BMl5BanBnXkFtZTcwODY0ODI4Mg@@.jpg")
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
it "should return nil if photo doesn't exist" do
|
42
42
|
# Natalie Tjern
|
43
43
|
@person = Spotlite::Person.new("0864666")
|
44
44
|
@person.photo_url.should be_nil
|
45
45
|
end
|
46
46
|
end
|
47
|
-
|
47
|
+
|
48
48
|
describe "filmography" do
|
49
49
|
before(:each) do
|
50
50
|
# Quentin Tarantino
|
51
51
|
@person = Spotlite::Person.new("0000233")
|
52
52
|
end
|
53
|
-
|
53
|
+
|
54
54
|
context "with basic jobs (director, actor, writer, producer), flattened to array" do
|
55
|
-
it "should return an array of
|
55
|
+
it "should return an array of 75..85 movies" do
|
56
56
|
@person.filmography.should be_an(Array)
|
57
|
-
@person.filmography.size.should be_within(5).of(
|
57
|
+
@person.filmography.size.should be_within(5).of(80)
|
58
58
|
@person.filmography.each{ |movie| movie.should be_a(Spotlite::Movie) }
|
59
59
|
@person.filmography.last.title.should eql("My Best Friend's Birthday")
|
60
60
|
@person.filmography.last.imdb_id.should eql("0359715")
|
61
61
|
end
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
context "with basic jobs (director, actor, writer, producer), expanded to a hash of arrays" do
|
65
65
|
it "should return a hash of 4 arrays" do
|
66
66
|
@person.filmography(false, false).should be_an(Hash)
|
67
67
|
@person.filmography(false, false).size.should eql(4)
|
68
68
|
@person.filmography(false, false).keys.should eql([:director, :actor, :writer, :producer])
|
69
69
|
end
|
70
|
-
|
70
|
+
|
71
71
|
it "should be able to retrieve an array of +Spotlite::Movie+ objects by a hash key" do
|
72
72
|
@person.filmography(false, false)[:actor].should be_an(Array)
|
73
73
|
@person.filmography(false, false)[:actor].size.should be_within(5).of(29)
|
@@ -76,24 +76,24 @@ describe "Spotlite::Person" do
|
|
76
76
|
@person.filmography(false, false)[:actor].last.imdb_id.should eql("1959459")
|
77
77
|
end
|
78
78
|
end
|
79
|
-
|
79
|
+
|
80
80
|
context "with all available jobs, flattened to array" do
|
81
|
-
it "should return an array of
|
81
|
+
it "should return an array of 175..195 movies" do
|
82
82
|
@person.filmography(true, true).should be_an(Array)
|
83
|
-
@person.filmography(true, true).size.should be_within(10).of(
|
83
|
+
@person.filmography(true, true).size.should be_within(10).of(185)
|
84
84
|
@person.filmography(true, true).each{ |movie| movie.should be_a(Spotlite::Movie) }
|
85
85
|
@person.filmography(true, true).last.title.should eql("The Typewriter, the Rifle & the Movie Camera")
|
86
86
|
@person.filmography(true, true).last.imdb_id.should eql("0118004")
|
87
87
|
end
|
88
88
|
end
|
89
|
-
|
89
|
+
|
90
90
|
context "with all available jobs, expanded to a hash of arrays" do
|
91
91
|
it "should return a hash of 11 arrays" do
|
92
92
|
@person.filmography(true, false).should be_an(Hash)
|
93
93
|
@person.filmography(true, false).size.should eql(11)
|
94
|
-
@person.filmography(true, false).keys.should eql([:writer, :actor, :
|
94
|
+
@person.filmography(true, false).keys.should eql([:writer, :actor, :producer, :director, :miscellaneous, :soundtrack, :cinematographer, :music_department, :editor, :thanks, :self])
|
95
95
|
end
|
96
|
-
|
96
|
+
|
97
97
|
it "should be able to retrieve an array of +Spotlite::Movie+ objects by a hash key" do
|
98
98
|
@person.filmography(true, false)[:thanks].should be_an(Array)
|
99
99
|
@person.filmography(true, false)[:thanks].size.should be_within(10).of(75)
|
@@ -104,7 +104,7 @@ describe "Spotlite::Person" do
|
|
104
104
|
end
|
105
105
|
end
|
106
106
|
end
|
107
|
-
|
107
|
+
|
108
108
|
describe "#find method" do
|
109
109
|
it "should return some people" do
|
110
110
|
results = Spotlite::Person.find("conan")
|
@@ -115,14 +115,14 @@ describe "Spotlite::Person" do
|
|
115
115
|
first.name.should eql("Alyssa Milano")
|
116
116
|
first.imdb_id.should eql("0000192")
|
117
117
|
end
|
118
|
-
|
118
|
+
|
119
119
|
it "should return no results" do
|
120
120
|
results = Spotlite::Person.find("herpinson derpington")
|
121
121
|
results.should be_an(Array)
|
122
122
|
results.size.should eql(0)
|
123
123
|
end
|
124
124
|
end
|
125
|
-
|
125
|
+
|
126
126
|
describe "#search method" do
|
127
127
|
it "should return some people" do
|
128
128
|
results = Spotlite::Person.search({count: 50})
|
@@ -131,5 +131,5 @@ describe "Spotlite::Person" do
|
|
131
131
|
results.each{ |person| person.should be_a(Spotlite::Person) }
|
132
132
|
end
|
133
133
|
end
|
134
|
-
|
134
|
+
|
135
135
|
end
|