themoviedb 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/spec/movie_spec.rb CHANGED
@@ -1,11 +1,8 @@
1
- # encoding: utf-8
2
- require 'rspec'
3
- require 'spec_helper'
4
- require 'vcr'
1
+ require "spec_helper"
5
2
 
6
- describe Tmdb::Movie do
3
+ RSpec.describe Tmdb::Movie do
7
4
  @fields = [:id, :adult, :backdrop_path, :belongs_to_collection,
8
- :budget, :genres, :homepage, :imdb_id, :original_title,
5
+ :budget, :genres, :homepage, :imdb_id, :original_language, :original_title,
9
6
  :overview, :popularity, :poster_path, :production_companies,
10
7
  :production_countries, :release_date, :revenue, :runtime,
11
8
  :spoken_languages, :status, :tagline, :title, :vote_average,
@@ -16,296 +13,300 @@ describe Tmdb::Movie do
16
13
  it { should respond_to field }
17
14
  end
18
15
 
19
- describe 'For a movie' do
16
+ describe "For a movie" do
20
17
  before(:each) do
21
18
  @movie = Tmdb::Movie
22
19
  end
23
20
 
24
- it 'should return the latest movies' do
25
- VCR.use_cassette 'movie/return_latest_movie' do
21
+ it "should return the latest movies" do
22
+ VCR.use_cassette "movie/return_latest_movie" do
26
23
  expect(@movie.latest).to be_truthy
27
24
  end
28
25
  end
29
26
 
30
- it 'should return the upcoming movies' do
31
- VCR.use_cassette 'movie/return_upcoming_movie' do
27
+ it "should return the upcoming movies" do
28
+ VCR.use_cassette "movie/return_upcoming_movie" do
32
29
  expect(@movie.upcoming).to be_truthy
33
30
  end
34
31
  end
35
32
 
36
- it 'should show movies that are now playing' do
37
- VCR.use_cassette 'movie/now_playing' do
33
+ it "should show movies that are now playing" do
34
+ VCR.use_cassette "movie/now_playing" do
38
35
  expect(@movie.now_playing).to be_truthy
39
36
  end
40
37
  end
41
38
 
42
- it 'should return popular movies' do
43
- VCR.use_cassette 'movie/popular' do
39
+ it "should return popular movies" do
40
+ VCR.use_cassette "movie/popular" do
44
41
  expect(@movie.popular).to be_truthy
45
42
  end
46
43
  end
47
44
 
48
- it 'should return top rated movies' do
49
- VCR.use_cassette 'movie/top_rated' do
45
+ it "should return top rated movies" do
46
+ VCR.use_cassette "movie/top_rated" do
50
47
  expect(@movie.top_rated).to be_truthy
51
48
  end
52
49
  end
53
50
 
54
- it 'should return alternative titles for an ID' do
55
- VCR.use_cassette 'movie/alternative_titles_for_id' do
51
+ it "should return alternative titles for an ID" do
52
+ VCR.use_cassette "movie/alternative_titles_for_id" do
56
53
  expect(@movie.alternative_titles(5)).to be_truthy
57
54
  end
58
55
  end
59
56
 
60
- it 'should return cast information for an ID' do
61
- VCR.use_cassette 'movie/cast_information_for_id' do
57
+ it "should return cast information for an ID" do
58
+ VCR.use_cassette "movie/cast_information_for_id" do
62
59
  expect(@movie.casts(5)).to be_truthy
63
60
  end
64
61
  end
65
62
 
66
- it 'should return crew for an ID' do
67
- VCR.use_cassette 'movie/crew_for_id' do
63
+ it "should return crew for an ID" do
64
+ VCR.use_cassette "movie/crew_for_id" do
68
65
  expect(@movie.crew(5)).to be_truthy
69
66
  end
70
67
  end
71
68
 
72
- it 'should return keywords for an ID' do
73
- VCR.use_cassette 'movie/keywords_for_id' do
69
+ it "should return keywords for an ID" do
70
+ VCR.use_cassette "movie/keywords_for_id" do
74
71
  expect(@movie.keywords(5)).to be_truthy
75
72
  end
76
73
  end
77
74
 
78
- it 'should return releases for an ID' do
79
- VCR.use_cassette 'movie/releases_for_id' do
75
+ it "should return releases for an ID" do
76
+ VCR.use_cassette "movie/releases_for_id" do
80
77
  expect(@movie.releases(5)).to be_truthy
81
78
  end
82
79
  end
83
80
 
84
- it 'should return trailers for an ID' do
85
- VCR.use_cassette 'movie/trailers_for_id' do
81
+ it "should return trailers for an ID" do
82
+ VCR.use_cassette "movie/trailers_for_id" do
86
83
  expect(@movie.trailers(5)).to be_truthy
87
84
  end
88
85
  end
89
86
 
90
- it 'should return translations for an ID' do
91
- VCR.use_cassette 'movie/translations_for_id' do
87
+ it "should return translations for an ID" do
88
+ VCR.use_cassette "movie/translations_for_id" do
92
89
  expect(@movie.translations(5)).to be_truthy
93
90
  end
94
91
  end
95
92
 
96
- it 'should return similar_movies for an ID' do
97
- VCR.use_cassette 'movie/similar_for_id' do
93
+ it "should return similar_movies for an ID" do
94
+ VCR.use_cassette "movie/similar_for_id" do
98
95
  expect(@movie.similar_movies(5)).to be_truthy
99
96
  end
100
97
  end
101
98
 
102
- it 'should return the list the movie belongs to' do
103
- VCR.use_cassette 'movie/movie_belongs_for_id' do
99
+ it "should return the list the movie belongs to" do
100
+ VCR.use_cassette "movie/movie_belongs_for_id" do
104
101
  expect(@movie.lists(5)).to be_truthy
105
102
  end
106
103
  end
107
104
 
108
- it 'should return the changes made' do
109
- VCR.use_cassette 'movie/changes_made' do
105
+ it "should return the changes made" do
106
+ VCR.use_cassette "movie/changes_made" do
110
107
  expect(@movie.changes(5)).to be_truthy
111
108
  end
112
109
  end
113
110
 
114
- it 'should return credits for an ID' do
115
- VCR.use_cassette 'movie/credits_for_id' do
111
+ it "should return credits for an ID" do
112
+ VCR.use_cassette "movie/credits_for_id" do
116
113
  expect(@movie.credits(5)).to be_truthy
117
114
  end
118
115
  end
119
116
  end
120
117
 
121
- describe 'For a movie detail' do
118
+ describe "For a movie detail" do
122
119
  before(:each) do
123
- VCR.use_cassette 'movie/detail' do
120
+ VCR.use_cassette "movie/detail" do
124
121
  @movie = Tmdb::Movie.detail(22_855)
125
122
  end
126
123
  end
127
124
 
128
- it 'should return a id' do
129
- expect(@movie['id']).to eq 22_855
125
+ it "should return a id" do
126
+ expect(@movie["id"]).to eq 22_855
130
127
  end
131
128
 
132
- it 'should return a adult' do
133
- expect(@movie['adult']).to eq false
129
+ it "should return a adult" do
130
+ expect(@movie["adult"]).to eq false
134
131
  end
135
132
 
136
- it 'should return a backdrop_path' do
137
- expect(@movie['backdrop_path']).to eq '/mXuqM7ksHW1AJ30AInwJvJTAwut.jpg'
133
+ it "should return a backdrop_path" do
134
+ expect(@movie["backdrop_path"]).to eq "/aMyEMGuW2NV3A0whuEM7VKp6M73.jpg"
138
135
  end
139
136
 
140
- it 'should return a belongs_to_collection' do
141
- expect(@movie['belongs_to_collection']['name']).to eq 'DC Universe Animated Original Movies'
137
+ it "should return a belongs_to_collection" do
138
+ expect(@movie["belongs_to_collection"]["name"]).to eq "Superman / Batman (Animated) Collection"
142
139
  end
143
140
 
144
- it 'should return a budget' do
145
- expect(@movie['budget']).to eq 0
141
+ it "should return a budget" do
142
+ expect(@movie["budget"]).to eq 0
146
143
  end
147
144
 
148
- it 'should return genres' do
149
- expect(@movie['genres']).not_to eq []
145
+ it "should return genres" do
146
+ expect(@movie["genres"]).not_to eq []
150
147
  end
151
148
 
152
- it 'should return homepage' do
153
- expect(@movie['homepage']).to eq 'http://www.warnervideo.com/supermanbatmandvd/'
149
+ it "should return homepage" do
150
+ expect(@movie["homepage"]).to eq "https://www.warnerbros.com/supermanbatman-public-enemies"
154
151
  end
155
152
 
156
- it 'should return a imdb_id' do
157
- expect(@movie['imdb_id']).to eq 'tt1398941'
153
+ it "should return a imdb_id" do
154
+ expect(@movie["imdb_id"]).to eq "tt1398941"
158
155
  end
159
156
 
160
- it 'should return a original_title' do
161
- expect(@movie['original_title']).to eq 'Superman/Batman: Public Enemies'
157
+ it "should return an original_language" do
158
+ expect(@movie["original_language"]).to eq "en"
162
159
  end
163
160
 
164
- it 'should return a overview' do
165
- expect(@movie['overview']).to eq "United States President Lex Luthor uses the oncoming trajectory of a Kryptonite meteor to frame Superman and declare a $1 billion bounty on the heads of the Man of Steel and his ‘partner in crime’, Batman. Heroes and villains alike launch a relentless pursuit of Superman and Batman, who must unite—and recruit help—to try and stave off the action-packed onslaught, stop the meteor Luthors plot."
161
+ it "should return a original_title" do
162
+ expect(@movie["original_title"]).to eq "Superman/Batman: Public Enemies"
166
163
  end
167
164
 
168
- it 'should return popularity' do
169
- expect(@movie['popularity']).to eq 1.15974723131612
165
+ it "should return a overview" do
166
+ expect(@movie["overview"]).to eq "United States President Lex Luthor uses the oncoming trajectory of a Kryptonite meteor to frame Superman and declare a $1 billion bounty on the heads of the Man of Steel and his ‘partner in crime’, Batman. Heroes and villains alike launch a relentless pursuit of Superman and Batman, who must unite—and recruit help—to try and stave off the action-packed onslaught, stop the meteor Luthors plot."
170
167
  end
171
168
 
172
- it 'should return poster_path' do
173
- expect(@movie['poster_path']).to eq '/7eaHkUKAzfstt6XQCiXyuKiZUAw.jpg'
169
+ it "should return popularity" do
170
+ expect(@movie["popularity"]).to eq 10.200109
174
171
  end
175
172
 
176
- it 'should return production_companies' do
177
- expect(@movie['production_companies']).not_to eq []
173
+ it "should return poster_path" do
174
+ expect(@movie["poster_path"]).to eq "/bJBZxzFHfTAOtBg8fOCCaBmh4hF.jpg"
178
175
  end
179
176
 
180
- it 'should return production_countries' do
181
- expect(@movie['production_countries']).not_to eq []
177
+ it "should return production_companies" do
178
+ expect(@movie["production_companies"]).not_to eq []
182
179
  end
183
180
 
184
- it 'should return release_date' do
185
- expect(@movie['release_date']).to eq '2009-09-29'
181
+ it "should return production_countries" do
182
+ expect(@movie["production_countries"]).not_to eq []
186
183
  end
187
184
 
188
- it 'should return revenue' do
189
- expect(@movie['revenue']).to eq 0
185
+ it "should return release_date" do
186
+ expect(@movie["release_date"]).to eq "2009-09-29"
190
187
  end
191
188
 
192
- it 'should return a runtime' do
193
- expect(@movie['runtime']).to eq 67
189
+ it "should return revenue" do
190
+ expect(@movie["revenue"]).to eq 0
194
191
  end
195
192
 
196
- it 'should return spoken_languages' do
197
- expect(@movie['spoken_languages'].first['name']).to eq 'English'
193
+ it "should return a runtime" do
194
+ expect(@movie["runtime"]).to eq 67
198
195
  end
199
196
 
200
- it 'should return status' do
201
- expect(@movie['status']).to eq 'Released'
197
+ it "should return spoken_languages" do
198
+ expect(@movie["spoken_languages"].first["name"]).to eq "English"
202
199
  end
203
200
 
204
- it 'should return vote_average' do
205
- expect(@movie['vote_average']).to eq 7.4
201
+ it "should return status" do
202
+ expect(@movie["status"]).to eq "Released"
206
203
  end
207
204
 
208
- it 'should return vote_count' do
209
- expect(@movie['vote_count']).to eq 23
205
+ it "should return vote_average" do
206
+ expect(@movie["vote_average"]).to eq 6.8
207
+ end
208
+
209
+ it "should return vote_count" do
210
+ expect(@movie["vote_count"]).to eq 199
210
211
  end
211
212
  end
212
213
 
213
- describe 'For a movie detail with appended response' do
214
+ describe "For a movie detail with appended response" do
214
215
  let(:append_fields) do
215
- %w( alternative_titles credits images keywords releases
216
- trailers translations reviews lists changes ).join(',')
216
+ %w[ alternative_titles credits images keywords releases
217
+ trailers translations reviews lists changes ].join(",")
217
218
  end
218
219
  before(:each) do
219
- VCR.use_cassette 'movie/detail_with_appended_response' do
220
+ VCR.use_cassette "movie/detail_with_appended_response" do
220
221
  @movie = Tmdb::Movie.detail(22_855, append_to_response: append_fields)
221
222
  end
222
223
  end
223
224
 
224
- it 'should return alternative_titles' do
225
- expect(@movie['alternative_titles']['titles'].size).to eq 4
226
- expect(@movie['alternative_titles']['titles'].first['title']).to eq 'Superman und Batman Public Enemies'
225
+ it "should return alternative_titles" do
226
+ expect(@movie["alternative_titles"]["titles"].size).to eq 4
227
+ expect(@movie["alternative_titles"]["titles"].first["title"]).to eq "Superman und Batman Public Enemies"
227
228
  end
228
229
 
229
- it 'should return credits' do
230
- expect(@movie['credits']['cast'].size).to eq 20
231
- expect(@movie['credits']['cast'].first['id']).to eq 34_947
232
- expect(@movie['credits']['crew'].size).to eq 3
233
- expect(@movie['credits']['crew'].first['id']).to eq 90_367
230
+ it "should return credits" do
231
+ expect(@movie["credits"]["cast"].size).to eq 20
232
+ expect(@movie["credits"]["cast"].first["id"]).to eq 34_947
233
+ expect(@movie["credits"]["crew"].size).to eq 3
234
+ expect(@movie["credits"]["crew"].first["id"]).to eq 90_367
234
235
  end
235
236
 
236
- it 'should return images' do
237
- expect(@movie['images']['backdrops'].size).to eq 6
238
- expect(@movie['images']['backdrops'].first['file_path']).to eq '/mXuqM7ksHW1AJ30AInwJvJTAwut.jpg'
239
- expect(@movie['images']['posters'].size).to eq 9
240
- expect(@movie['images']['posters'].first['file_path']).to eq '/7eaHkUKAzfstt6XQCiXyuKiZUAw.jpg'
237
+ it "should return images" do
238
+ expect(@movie["images"]["backdrops"].size).to eq 6
239
+ expect(@movie["images"]["backdrops"].first["file_path"]).to eq "/mXuqM7ksHW1AJ30AInwJvJTAwut.jpg"
240
+ expect(@movie["images"]["posters"].size).to eq 9
241
+ expect(@movie["images"]["posters"].first["file_path"]).to eq "/7eaHkUKAzfstt6XQCiXyuKiZUAw.jpg"
241
242
  end
242
243
 
243
- it 'should return keywords' do
244
- expect(@movie['keywords']['keywords'].size).to eq 2
245
- expect(@movie['keywords']['keywords'].first['id']).to eq 9715
244
+ it "should return keywords" do
245
+ expect(@movie["keywords"]["keywords"].size).to eq 2
246
+ expect(@movie["keywords"]["keywords"].first["id"]).to eq 9715
246
247
  end
247
248
 
248
- it 'should return releases' do
249
- expect(@movie['releases']['countries'].size).to eq 1
250
- expect(@movie['releases']['countries'].first['release_date']).to eq '2009-09-29'
249
+ it "should return releases" do
250
+ expect(@movie["releases"]["countries"].size).to eq 1
251
+ expect(@movie["releases"]["countries"].first["release_date"]).to eq "2009-09-29"
251
252
  end
252
253
 
253
- it 'should return trailers' do
254
- expect(@movie['trailers']['quicktime']).to eq []
255
- expect(@movie['trailers']['youtube'].size).to eq 1
256
- expect(@movie['trailers']['youtube'].first['name']).to eq 'Official Preview Trailer'
254
+ it "should return trailers" do
255
+ expect(@movie["trailers"]["quicktime"]).to eq []
256
+ expect(@movie["trailers"]["youtube"].size).to eq 1
257
+ expect(@movie["trailers"]["youtube"].first["name"]).to eq "Official Preview Trailer"
257
258
  end
258
259
 
259
- it 'should return translations' do
260
- expect(@movie['translations']['translations'].size).to eq 13
261
- expect(@movie['translations']['translations'].first['name']).to eq 'English'
260
+ it "should return translations" do
261
+ expect(@movie["translations"]["translations"].size).to eq 13
262
+ expect(@movie["translations"]["translations"].first["name"]).to eq "English"
262
263
  end
263
264
 
264
- it 'should return reviews' do
265
- expect(@movie['reviews']['results']).to eq []
265
+ it "should return reviews" do
266
+ expect(@movie["reviews"]["results"]).to eq []
266
267
  end
267
268
 
268
- it 'should return lists' do
269
- expect(@movie['lists']['results'].size).to eq 4
270
- expect(@movie['lists']['results'].first['id']).to eq '51d6b52219c295172912ff1e'
269
+ it "should return lists" do
270
+ expect(@movie["lists"]["results"].size).to eq 4
271
+ expect(@movie["lists"]["results"].first["id"]).to eq "51d6b52219c295172912ff1e"
271
272
  end
272
273
 
273
- it 'should return changes' do
274
- expect(@movie['changes']['changes']).to eq []
274
+ it "should return changes" do
275
+ expect(@movie["changes"]["changes"]).to eq []
275
276
  end
276
277
  end
277
278
 
278
- describe 'For a movies images' do
279
+ describe "For a movies images" do
279
280
  before(:each) do
280
- VCR.use_cassette 'movie/images' do
281
+ VCR.use_cassette "movie/images" do
281
282
  @movie = Tmdb::Movie.images(22_855)
282
283
  end
283
284
  end
284
285
 
285
- it 'should return backdrops' do
286
- @movie['backdrops'].length == 4
286
+ it "should return backdrops" do
287
+ @movie["backdrops"].length == 4
287
288
  end
288
289
 
289
- it 'should return posters' do
290
- expect(@movie['posters']).to be_truthy
290
+ it "should return posters" do
291
+ expect(@movie["posters"]).to be_truthy
291
292
  end
292
293
  end
293
294
 
294
- describe 'For other languages' do
295
+ describe "For other languages" do
295
296
  before(:each) do
296
- Tmdb::Api.language('de')
297
- VCR.use_cassette 'movie/language_german' do
297
+ Tmdb::Api.language("de")
298
+ VCR.use_cassette "movie/language_german" do
298
299
  @movie = Tmdb::Movie.detail(562)
299
300
  end
300
301
  Tmdb::Api.language(nil)
301
302
  end
302
303
 
303
- it 'should return the german name' do
304
- expect(@movie['title']).to eq 'Stirb Langsam'
304
+ it "should return the german name" do
305
+ expect(@movie["title"]).to eq "Stirb Langsam"
305
306
  end
306
307
 
307
- it 'should return the german description' do
308
- expect(@movie['overview']).to eq "Eigentlich möchte der New Yorker Polizist John McClane dieses Weihnachten nur seine Noch-Ehefrau Holly, welche in Los Angeles in einer großen, erfolgreichen Firma Karriere gemacht hat, besuchen und das Fest mit den beiden gemeinsamen Kinder verbringen. Als die Feierlichkeiten im Nakatomi Plaza beginnen sollen, stürmt eine Gruppe von Terroristen das Hochhaus und nur John McClane schafft es ihnen zu entwischen. Lediglich bewaffnet mit ein paar Zigaretten und einem Walkie-Talkie, wodurch er den Funk der Geiselnehmer mithören kann, und mit Waffen, welche die Terroristen gelegentlich so rumliegen lassen, muss John nun nicht nur sein eigenes Leben retten, sondern möglichst auch das aller anderen Beteiligten. Und so beschließt er, die äußerst brutale Truppe auszumerzen und sich einen Terroristen nach dem anderen vorzuknöpfen. Während draußen dann schon die Polizei und das FBI stümperhaft versucht, das Gebäude zu stürmen, kämpft McClane ohne Schuhe gegen die 12 Aggressoren..."
308
+ it "should return the german description" do
309
+ expect(@movie["overview"]).to eq "Eigentlich möchte der New Yorker Polizist John McClane dieses Weihnachten nur seine Noch-Ehefrau Holly, welche in Los Angeles in einer großen, erfolgreichen Firma Karriere gemacht hat, besuchen und das Fest mit den beiden gemeinsamen Kinder verbringen. Als die Feierlichkeiten im Nakatomi Plaza beginnen sollen, stürmt eine Gruppe von Terroristen das Hochhaus und nur John McClane schafft es ihnen zu entwischen. Lediglich bewaffnet mit ein paar Zigaretten und einem Walkie-Talkie, wodurch er den Funk der Geiselnehmer mithören kann, und mit Waffen, welche die Terroristen gelegentlich so rumliegen lassen, muss John nun nicht nur sein eigenes Leben retten, sondern möglichst auch das aller anderen Beteiligten. Und so beschließt er, die äußerst brutale Truppe auszumerzen und sich einen Terroristen nach dem anderen vorzuknöpfen. Während draußen dann schon die Polizei und das FBI stümperhaft versucht, das Gebäude zu stürmen, kämpft McClane ohne Schuhe gegen die 12 Aggressoren..."
309
310
  end
310
311
  end
311
312
  end