themoviedb 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +459 -0
- data/lib/themoviedb.rb +4 -5
- data/lib/themoviedb/api.rb +4 -5
- data/lib/themoviedb/collection.rb +6 -7
- data/lib/themoviedb/company.rb +7 -8
- data/lib/themoviedb/configuration.rb +2 -2
- data/lib/themoviedb/episode.rb +16 -17
- data/lib/themoviedb/find.rb +11 -12
- data/lib/themoviedb/genre.rb +53 -57
- data/lib/themoviedb/job.rb +3 -5
- data/lib/themoviedb/movie.rb +62 -63
- data/lib/themoviedb/person.rb +37 -33
- data/lib/themoviedb/resource.rb +19 -21
- data/lib/themoviedb/search.rb +30 -30
- data/lib/themoviedb/season.rb +16 -17
- data/lib/themoviedb/tv.rb +24 -25
- data/lib/themoviedb/version.rb +2 -1
- data/spec/company_spec.rb +31 -36
- data/spec/find_spec.rb +10 -13
- data/spec/movie_spec.rb +124 -129
- data/spec/person_spec.rb +53 -53
- data/spec/spec/vcr/find/search_imdb.yml +39 -0
- data/spec/spec_helper.rb +29 -0
- data/spec/tv_spec.rb +196 -217
- data/spec/vcr/company/detail.yml +67 -0
- data/spec/vcr/company/movies.yml +98 -0
- data/spec/vcr/find/search_imdb.yml +50 -0
- data/spec/vcr/find/search_tvdb.yml +52 -0
- data/spec/vcr/movie/alternative_titles_for_id.yml +69 -0
- data/spec/vcr/movie/cast_information_for_id.yml +109 -0
- data/spec/vcr/movie/changes_made.yml +60 -0
- data/spec/vcr/movie/credits_for_id.yml +99 -0
- data/spec/vcr/movie/crew_for_id.yml +109 -0
- data/spec/vcr/movie/detail.yml +93 -0
- data/spec/vcr/movie/detail_with_appended_response.yml +254 -0
- data/spec/vcr/movie/images.yml +62 -0
- data/spec/vcr/movie/keywords_for_id.yml +62 -0
- data/spec/vcr/movie/language_german.yml +112 -0
- data/spec/vcr/movie/movie_belongs_for_id.yml +89 -0
- data/spec/vcr/movie/now_playing.yml +90 -0
- data/spec/vcr/movie/popular.yml +96 -0
- data/spec/vcr/movie/releases_for_id.yml +60 -0
- data/spec/vcr/movie/return_latest_movie.yml +62 -0
- data/spec/vcr/movie/return_upcoming_movie.yml +186 -0
- data/spec/vcr/movie/similar_for_id.yml +180 -0
- data/spec/vcr/movie/top_rated.yml +190 -0
- data/spec/vcr/movie/trailers_for_id.yml +60 -0
- data/spec/vcr/movie/translations_for_id.yml +76 -0
- data/spec/vcr/person/changes.yml +50 -0
- data/spec/vcr/person/credits.yml +459 -0
- data/spec/vcr/person/detail.yml +65 -0
- data/spec/vcr/person/detail_with_appended_response.yml +762 -0
- data/spec/vcr/person/images.yml +50 -0
- data/spec/vcr/person/latest.yml +51 -0
- data/spec/vcr/person/popular.yml +125 -0
- data/spec/vcr/tv/cast.yml +74 -0
- data/spec/vcr/tv/crew.yml +74 -0
- data/spec/vcr/tv/detail.yml +63 -0
- data/spec/vcr/tv/detail_with_appeded_response.yml +76 -0
- data/spec/vcr/tv/external_ids.yml +60 -0
- data/spec/vcr/tv/images.yml +121 -0
- data/spec/vcr/tv/popular.yml +96 -0
- data/spec/vcr/tv/test_chuck.yml +52 -0
- data/spec/vcr/tv/top_rated.yml +84 -0
- data/themoviedb.gemspec +10 -35
- metadata +94 -9
data/spec/person_spec.rb
CHANGED
@@ -1,98 +1,98 @@
|
|
1
|
-
#encoding: utf-8
|
1
|
+
# encoding: utf-8
|
2
2
|
require 'rspec'
|
3
3
|
require 'spec_helper'
|
4
4
|
require 'vcr'
|
5
5
|
|
6
6
|
describe Tmdb::Person do
|
7
|
-
@fields = [:id
|
8
|
-
:adult
|
9
|
-
:profile_path
|
10
|
-
:images
|
7
|
+
@fields = [:id, :name, :place_of_birth, :also_known_as,
|
8
|
+
:adult, :biography, :birthday, :deathday, :homepage,
|
9
|
+
:profile_path, :movie_credits, :tv_credits, :combined_credits,
|
10
|
+
:images, :changes]
|
11
11
|
|
12
12
|
@fields.each do |field|
|
13
13
|
it { should respond_to field }
|
14
14
|
end
|
15
15
|
|
16
|
-
describe
|
16
|
+
describe 'For person p' do
|
17
17
|
before(:each) do
|
18
18
|
@person = Tmdb::Person
|
19
19
|
end
|
20
20
|
|
21
|
-
it
|
21
|
+
it 'should return the popular people' do
|
22
22
|
VCR.use_cassette 'person/popular' do
|
23
|
-
@person.popular.
|
23
|
+
expect(@person.popular).to be_truthy
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
it
|
27
|
+
it 'should return the latest person' do
|
28
28
|
VCR.use_cassette 'person/latest' do
|
29
|
-
@person.latest.
|
29
|
+
expect(@person.latest).to be_truthy
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
it
|
33
|
+
it 'should return credits for a person ID' do
|
34
34
|
VCR.use_cassette 'person/credits' do
|
35
|
-
@person.credits(5292).
|
35
|
+
expect(@person.credits(5292)).to be_truthy
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
it
|
39
|
+
it 'should return changes for a person ID' do
|
40
40
|
VCR.use_cassette 'person/changes' do
|
41
|
-
@person.changes(5292).
|
41
|
+
expect(@person.changes(5292)).to be_truthy
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
describe
|
46
|
+
describe 'For a person detail' do
|
47
47
|
before(:each) do
|
48
48
|
VCR.use_cassette 'person/detail' do
|
49
49
|
@person = Tmdb::Person.detail(5292)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
it
|
54
|
-
@person['id'].
|
53
|
+
it 'should return a id' do
|
54
|
+
expect(@person['id']).to eq 5292
|
55
55
|
end
|
56
56
|
|
57
|
-
it
|
58
|
-
@person['name'].
|
57
|
+
it 'should return a name' do
|
58
|
+
expect(@person['name']).to eq 'Denzel Washington'
|
59
59
|
end
|
60
60
|
|
61
|
-
it
|
62
|
-
@person['adult'].
|
61
|
+
it 'should return a adult' do
|
62
|
+
expect(@person['adult']).to eq false
|
63
63
|
end
|
64
64
|
|
65
|
-
it
|
66
|
-
@person['biography'].
|
65
|
+
it 'should return a biography' do
|
66
|
+
expect(@person['biography']).to eq "From Wikipedia, the free encyclopedia.\n\nDenzel Hayes Washington, Jr. (born December 28, 1954) is an American actor, screenwriter, director and film producer. He first rose to prominence when he joined the cast of the medical drama St. Elsewhere, playing Dr. Philip Chandler for six years. He has received much critical acclaim for his work in film since the 1990s, including for his portrayals of real-life figures, such as Steve Biko, Malcolm X, Rubin \"Hurricane\" Carter, Melvin B. Tolson, Frank Lucas, and Herman Boone.\n\nWashington has received two Academy Awards, two Golden Globe awards, a Tony Award. He is notable for winning the Best Supporting Actor for Glory in 1989; and the Academy Award for Best Actor in 2001 for his role in the film Training Day\n\nDescription above from the Wikipedia article Denzel Washington, licensed under CC-BY-SA, full list of contributors on Wikipedia."
|
67
67
|
end
|
68
68
|
|
69
|
-
it
|
70
|
-
@person['birthday'].
|
69
|
+
it 'should return a birthday' do
|
70
|
+
expect(@person['birthday']).to eq '1954-12-28'
|
71
71
|
end
|
72
72
|
|
73
|
-
it
|
74
|
-
@person['deathday'].
|
73
|
+
it 'should return a deathday' do
|
74
|
+
expect(@person['deathday']).to eq ''
|
75
75
|
end
|
76
76
|
|
77
|
-
it
|
78
|
-
@person['homepage'].
|
77
|
+
it 'should return a homepage' do
|
78
|
+
expect(@person['homepage']).to eq ''
|
79
79
|
end
|
80
80
|
|
81
|
-
it
|
82
|
-
@person['place_of_birth'].
|
81
|
+
it 'should return a place of birth' do
|
82
|
+
expect(@person['place_of_birth']).to eq 'Mount Vernon, New York, USA'
|
83
83
|
end
|
84
84
|
|
85
|
-
it
|
86
|
-
@person['profile_path'].
|
85
|
+
it 'should return a profile path' do
|
86
|
+
expect(@person['profile_path']).to eq '/khMf8LLTtppUwuZqqnigD2nAy26.jpg'
|
87
87
|
end
|
88
88
|
|
89
|
-
it
|
90
|
-
@person['also_known_as'].
|
89
|
+
it 'should return an array with also known as names' do
|
90
|
+
expect(@person['also_known_as']).to eq []
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
94
|
describe 'For a person detail with appended response' do
|
95
|
-
let(:append_fields) { %w
|
95
|
+
let(:append_fields) { %w( movie_credits tv_credits combined_credits images changes ).join(',') }
|
96
96
|
|
97
97
|
before(:each) do
|
98
98
|
VCR.use_cassette 'person/detail_with_appended_response' do
|
@@ -101,44 +101,44 @@ describe Tmdb::Person do
|
|
101
101
|
end
|
102
102
|
|
103
103
|
it 'should return movie credits' do
|
104
|
-
@person['movie_credits']['cast'].size.
|
105
|
-
@person['movie_credits']['cast'].first['id'].
|
106
|
-
@person['movie_credits']['crew'].size.
|
107
|
-
@person['movie_credits']['crew'].first['id'].
|
104
|
+
expect(@person['movie_credits']['cast'].size).to eq 47
|
105
|
+
expect(@person['movie_credits']['cast'].first['id']).to eq 388
|
106
|
+
expect(@person['movie_credits']['crew'].size).to eq 4
|
107
|
+
expect(@person['movie_credits']['crew'].first['id']).to eq 13_435
|
108
108
|
end
|
109
109
|
|
110
110
|
it 'should return tv credits' do
|
111
|
-
@person['tv_credits']['cast'].size.
|
112
|
-
@person['tv_credits']['cast'].first['id'].
|
113
|
-
@person['tv_credits']['crew'].size.
|
114
|
-
@person['tv_credits']['crew'].first['id'].
|
111
|
+
expect(@person['tv_credits']['cast'].size).to eq 17
|
112
|
+
expect(@person['tv_credits']['cast'].first['id']).to eq 1709
|
113
|
+
expect(@person['tv_credits']['crew'].size).to eq 3
|
114
|
+
expect(@person['tv_credits']['crew'].first['id']).to eq 18_881
|
115
115
|
end
|
116
116
|
|
117
117
|
it 'should return combined credits' do
|
118
|
-
@person['combined_credits']['cast'].size.
|
119
|
-
@person['combined_credits']['cast'].first['id'].
|
120
|
-
@person['combined_credits']['crew'].size.
|
121
|
-
@person['combined_credits']['crew'].first['id'].
|
118
|
+
expect(@person['combined_credits']['cast'].size).to eq 64
|
119
|
+
expect(@person['combined_credits']['cast'].first['id']).to eq 388
|
120
|
+
expect(@person['combined_credits']['crew'].size).to eq 7
|
121
|
+
expect(@person['combined_credits']['crew'].first['id']).to eq 13_435
|
122
122
|
end
|
123
123
|
|
124
124
|
it 'should return images' do
|
125
|
-
@person['images']['profiles'].size.
|
126
|
-
@person['images']['profiles'].first['file_path'].
|
125
|
+
expect(@person['images']['profiles'].size).to eq 6
|
126
|
+
expect(@person['images']['profiles'].first['file_path']).to eq '/khMf8LLTtppUwuZqqnigD2nAy26.jpg'
|
127
127
|
end
|
128
128
|
|
129
129
|
it 'should return changes' do
|
130
|
-
@person['changes']['changes'].
|
130
|
+
expect(@person['changes']['changes']).to eq []
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
134
|
-
describe
|
134
|
+
describe 'For images of a person' do
|
135
135
|
before(:each) do
|
136
136
|
VCR.use_cassette 'person/images' do
|
137
137
|
@person_images = Tmdb::Person.images(5292)
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
141
|
-
it
|
141
|
+
it 'should return profiles' do
|
142
142
|
@person_images['profiles'].length == 6
|
143
143
|
end
|
144
144
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://api.themoviedb.org/3/find/tt1375666?external_source=tvdb_id
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/json
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 401
|
17
|
+
message: Unauthorized
|
18
|
+
headers:
|
19
|
+
Access-Control-Allow-Origin:
|
20
|
+
- '*'
|
21
|
+
Content-Type:
|
22
|
+
- application/json;charset=utf-8
|
23
|
+
Date:
|
24
|
+
- Thu, 26 Dec 2013 20:09:42 GMT
|
25
|
+
Server:
|
26
|
+
- nginx
|
27
|
+
Status:
|
28
|
+
- 401 Unauthorized
|
29
|
+
Content-Length:
|
30
|
+
- '86'
|
31
|
+
Connection:
|
32
|
+
- keep-alive
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: '{"status_code":7,"status_message":"Invalid API key - You must be granted
|
36
|
+
a valid key"}'
|
37
|
+
http_version:
|
38
|
+
recorded_at: Thu, 26 Dec 2013 20:09:41 GMT
|
39
|
+
recorded_with: VCR 2.5.0
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
4
|
+
# loaded once.
|
5
|
+
#
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
+
|
8
|
+
require_relative '../lib/themoviedb.rb'
|
9
|
+
require 'vcr'
|
10
|
+
|
11
|
+
Tmdb::Api.key('8a221fc31fcdf12a8af827465574ffc9')
|
12
|
+
|
13
|
+
VCR.configure do |c|
|
14
|
+
# the directory where your cassettes will be saved
|
15
|
+
c.cassette_library_dir = 'spec/vcr'
|
16
|
+
# your HTTP request service. You can also use fakeweb, webmock, and more
|
17
|
+
c.hook_into :webmock
|
18
|
+
end
|
19
|
+
|
20
|
+
RSpec.configure do |config|
|
21
|
+
config.run_all_when_everything_filtered = true
|
22
|
+
config.filter_run :focus
|
23
|
+
|
24
|
+
# Run specs in random order to surface order dependencies. If you find an
|
25
|
+
# order dependency and want to debug it, you can fix the order by providing
|
26
|
+
# the seed, which is printed after each run.
|
27
|
+
# --seed 1234
|
28
|
+
config.order = 'random'
|
29
|
+
end
|
data/spec/tv_spec.rb
CHANGED
@@ -3,160 +3,157 @@ require 'spec_helper'
|
|
3
3
|
require 'vcr'
|
4
4
|
|
5
5
|
describe Tmdb::TV do
|
6
|
-
|
7
6
|
@fields = [
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
7
|
+
:backdrop_path,
|
8
|
+
:created_by,
|
9
|
+
:episode_run_time,
|
10
|
+
:first_air_date,
|
11
|
+
:genres,
|
12
|
+
:homepage,
|
13
|
+
:id,
|
14
|
+
:in_production,
|
15
|
+
:languages,
|
16
|
+
:last_air_date,
|
17
|
+
:name,
|
18
|
+
:networks,
|
19
|
+
:number_of_episodes,
|
20
|
+
:number_of_seasons,
|
21
|
+
:original_name,
|
22
|
+
:origin_country,
|
23
|
+
:overview,
|
24
|
+
:popularity,
|
25
|
+
:poster_path,
|
26
|
+
:seasons,
|
27
|
+
:status,
|
28
|
+
:vote_average,
|
29
|
+
:vote_count,
|
30
|
+
:credits,
|
31
|
+
:external_ids
|
32
|
+
]
|
34
33
|
|
35
34
|
@fields.each do |field|
|
36
35
|
it { should respond_to field }
|
37
36
|
end
|
38
37
|
|
39
|
-
describe
|
38
|
+
describe 'For Chuck it should return images' do
|
40
39
|
before(:each) do
|
41
40
|
VCR.use_cassette 'tv/test_chuck' do
|
42
41
|
@tv = Tmdb::TV.images(1404)
|
43
42
|
end
|
44
43
|
end
|
45
44
|
|
46
|
-
it
|
47
|
-
@tv['backdrops'].length.
|
45
|
+
it 'should return backdrops for chuck' do
|
46
|
+
expect(@tv['backdrops'].length).to be >= 1
|
48
47
|
end
|
49
48
|
|
50
|
-
it
|
51
|
-
@tv['posters'].length.
|
49
|
+
it 'should return posters for chuck' do
|
50
|
+
expect(@tv['posters'].length).to be >= 1
|
52
51
|
end
|
53
52
|
end
|
54
53
|
|
55
|
-
describe
|
56
|
-
|
54
|
+
describe 'For a TV detail' do
|
57
55
|
before(:each) do
|
58
56
|
VCR.use_cassette 'tv/detail' do
|
59
57
|
@tv = Tmdb::TV.detail(1396)
|
60
58
|
end
|
61
59
|
end
|
62
60
|
|
63
|
-
it
|
64
|
-
@tv['id'].
|
61
|
+
it 'should return a id' do
|
62
|
+
expect(@tv['id']).to eq 1396
|
65
63
|
end
|
66
64
|
|
67
|
-
it
|
68
|
-
@tv['backdrop_path'].
|
65
|
+
it 'should return a backdrop' do
|
66
|
+
expect(@tv['backdrop_path']).to eq '/8STVFl9kvWtFAydXUFHIUvT47AA.jpg'
|
69
67
|
end
|
70
68
|
|
71
|
-
it
|
72
|
-
@tv['created_by'].first['name'].
|
69
|
+
it 'should return a created date' do
|
70
|
+
expect(@tv['created_by'].first['name']).to eq 'Vince Gilligan'
|
73
71
|
end
|
74
72
|
|
75
|
-
it
|
76
|
-
@tv['episode_run_time'].
|
73
|
+
it 'should return a run time' do
|
74
|
+
expect(@tv['episode_run_time']).to eq [45, 47]
|
77
75
|
end
|
78
76
|
|
79
|
-
it
|
80
|
-
@tv['genres'].
|
77
|
+
it 'should return genres' do
|
78
|
+
expect(@tv['genres']).not_to eq []
|
81
79
|
end
|
82
80
|
|
83
|
-
it
|
84
|
-
@tv['first_air_date'].
|
81
|
+
it 'should return a first air date' do
|
82
|
+
expect(@tv['first_air_date']).to eq '2008-01-20'
|
85
83
|
end
|
86
84
|
|
87
|
-
it
|
88
|
-
@tv['homepage'].
|
85
|
+
it 'should return a homepage' do
|
86
|
+
expect(@tv['homepage']).to eq 'http://www.amctv.com/shows/breaking-bad'
|
89
87
|
end
|
90
88
|
|
91
|
-
it
|
92
|
-
@tv['in_production'].
|
89
|
+
it 'should return a production state' do
|
90
|
+
expect(@tv['in_production']).to be_falsey
|
93
91
|
end
|
94
92
|
|
95
|
-
it
|
96
|
-
@tv['languages'].
|
93
|
+
it 'should return languages' do
|
94
|
+
expect(@tv['languages']).to eq %w(en de ro es fa)
|
97
95
|
end
|
98
96
|
|
99
|
-
it
|
100
|
-
@tv['last_air_date'].
|
97
|
+
it 'should return a last air date' do
|
98
|
+
expect(@tv['last_air_date']).to eq '2013-09-29'
|
101
99
|
end
|
102
100
|
|
103
|
-
it
|
104
|
-
@tv['name'].
|
101
|
+
it 'should return a name' do
|
102
|
+
expect(@tv['name']).to eq 'Breaking Bad'
|
105
103
|
end
|
106
104
|
|
107
|
-
it
|
108
|
-
@tv['networks'].first['id'].
|
109
|
-
@tv['networks'].first['name'] ==
|
105
|
+
it 'should return a network' do
|
106
|
+
expect(@tv['networks'].first['id']).to eq 174
|
107
|
+
@tv['networks'].first['name'] == 'AMC'
|
110
108
|
end
|
111
109
|
|
112
|
-
it
|
113
|
-
@tv['number_of_episodes'].
|
110
|
+
it 'should return the number of episodes' do
|
111
|
+
expect(@tv['number_of_episodes']).to eq 62
|
114
112
|
end
|
115
113
|
|
116
|
-
it
|
117
|
-
@tv['number_of_seasons'].
|
114
|
+
it 'should return the number of seasons' do
|
115
|
+
expect(@tv['number_of_seasons']).to eq 5
|
118
116
|
end
|
119
117
|
|
120
|
-
it
|
121
|
-
@tv['original_name'].
|
118
|
+
it 'should return the original name' do
|
119
|
+
expect(@tv['original_name']).to eq 'Breaking Bad'
|
122
120
|
end
|
123
121
|
|
124
|
-
it
|
125
|
-
@tv['origin_country'].
|
122
|
+
it 'should return the origin country' do
|
123
|
+
expect(@tv['origin_country']).to eq ['US']
|
126
124
|
end
|
127
125
|
|
128
|
-
it
|
129
|
-
@tv['overview'].
|
126
|
+
it 'should return a overview' do
|
127
|
+
expect(@tv['overview']).to eq "Breaking Bad is an American crime drama television series created and produced by Vince Gilligan. Set and produced in Albuquerque, New Mexico, Breaking Bad is the story of Walter White, a struggling high school chemistry teacher who is diagnosed with inoperable lung cancer at the beginning of the series. He turns to a life of crime, producing and selling methamphetamine, in order to secure his family's financial future before he dies, teaming with his former student, Jesse Pinkman. Heavily serialized, the series is known for positioning its characters in seemingly inextricable corners and has been labeled a contemporary western by its creator."
|
130
128
|
end
|
131
129
|
|
132
|
-
it
|
133
|
-
@tv['popularity'].
|
130
|
+
it 'should return a popularity rating' do
|
131
|
+
expect(@tv['popularity']).to eq 6.60821276854239
|
134
132
|
end
|
135
133
|
|
136
|
-
it
|
137
|
-
@tv['poster_path'].
|
134
|
+
it 'should return a poster' do
|
135
|
+
expect(@tv['poster_path']).to eq '/iRDNn9EHKuBhGa77UBteazvsZa1.jpg'
|
138
136
|
end
|
139
137
|
|
140
|
-
it
|
141
|
-
@tv['seasons'].
|
138
|
+
it 'should return seasons' do
|
139
|
+
expect(@tv['seasons']).not_to eq []
|
142
140
|
end
|
143
141
|
|
144
|
-
it
|
145
|
-
@tv['status'].
|
142
|
+
it 'should return a status' do
|
143
|
+
expect(@tv['status']).to eq 'Ended'
|
146
144
|
end
|
147
145
|
|
148
|
-
it
|
149
|
-
@tv['vote_average'].
|
146
|
+
it 'should return a vote average' do
|
147
|
+
expect(@tv['vote_average']).to eq 8.86764705882353
|
150
148
|
end
|
151
149
|
|
152
|
-
it
|
153
|
-
@tv['vote_count'].
|
150
|
+
it 'should return a vote count' do
|
151
|
+
expect(@tv['vote_count']).to eq 34
|
154
152
|
end
|
155
|
-
|
156
153
|
end
|
157
154
|
|
158
|
-
describe
|
159
|
-
let(:append_fields) { %w
|
155
|
+
describe 'For a TV detail with appended response' do
|
156
|
+
let(:append_fields) { %w( credits external_ids ).join(',') }
|
160
157
|
|
161
158
|
before(:each) do
|
162
159
|
VCR.use_cassette 'tv/detail_with_appeded_response' do
|
@@ -165,294 +162,276 @@ describe Tmdb::TV do
|
|
165
162
|
end
|
166
163
|
|
167
164
|
it 'should return credits' do
|
168
|
-
@tv['credits']['cast'].size.
|
169
|
-
@tv['credits']['cast'].first['id'].
|
170
|
-
@tv['credits']['crew'].size.
|
171
|
-
@tv['credits']['crew'].first['id'].
|
165
|
+
expect(@tv['credits']['cast'].size).to eq 7
|
166
|
+
expect(@tv['credits']['cast'].first['id']).to eq 17_419
|
167
|
+
expect(@tv['credits']['crew'].size).to eq 4
|
168
|
+
expect(@tv['credits']['crew'].first['id']).to eq 5162
|
172
169
|
end
|
173
170
|
|
174
171
|
it 'should return external_ids' do
|
175
|
-
@tv['external_ids']['imdb_id'].
|
172
|
+
expect(@tv['external_ids']['imdb_id']).to eq 'tt0903747'
|
176
173
|
end
|
177
174
|
end
|
178
175
|
|
179
|
-
describe
|
180
|
-
|
176
|
+
describe 'For popular TV shows' do
|
181
177
|
before(:each) do
|
182
178
|
VCR.use_cassette 'tv/popular' do
|
183
179
|
@tv = Tmdb::TV.popular
|
184
180
|
end
|
185
181
|
end
|
186
182
|
|
187
|
-
it
|
188
|
-
@tv.class.
|
183
|
+
it 'should return an array' do
|
184
|
+
expect(@tv.class).to eq Array
|
189
185
|
end
|
190
186
|
|
191
|
-
it
|
192
|
-
@tv.first
|
187
|
+
it 'each show should return an id' do
|
188
|
+
expect(@tv.first.id).to eq 57_243
|
193
189
|
end
|
194
190
|
|
195
|
-
it
|
196
|
-
@tv.first
|
191
|
+
it 'each show should return an name' do
|
192
|
+
expect(@tv.first.name).to eq 'Doctor Who'
|
197
193
|
end
|
198
194
|
|
199
|
-
it
|
200
|
-
@tv.first
|
195
|
+
it 'each show should return an original name' do
|
196
|
+
expect(@tv.first.original_name).to eq 'Doctor Who'
|
201
197
|
end
|
202
198
|
|
203
|
-
it
|
204
|
-
@tv.first
|
199
|
+
it 'each show should return an popularity' do
|
200
|
+
expect(@tv.first.popularity).to eq 16.5167252220739
|
205
201
|
end
|
206
202
|
|
207
|
-
it
|
208
|
-
@tv.first
|
203
|
+
it 'each show should return an poster_path' do
|
204
|
+
expect(@tv.first.poster_path).to eq '/4a94ptIdYz0JwSzo0dCNuPCcfM8.jpg'
|
209
205
|
end
|
210
206
|
|
211
|
-
it
|
212
|
-
@tv.first
|
207
|
+
it 'each show should return an vote_average' do
|
208
|
+
expect(@tv.first.vote_average).to eq 7.875
|
213
209
|
end
|
214
210
|
|
215
|
-
it
|
216
|
-
@tv.first
|
211
|
+
it 'each show should return an vote_count' do
|
212
|
+
expect(@tv.first.vote_count).to eq 4
|
217
213
|
end
|
218
214
|
|
219
|
-
it
|
220
|
-
@tv.first
|
215
|
+
it 'each show should return an backdrop' do
|
216
|
+
expect(@tv.first.backdrop_path).to eq nil
|
221
217
|
end
|
222
218
|
|
223
|
-
it
|
224
|
-
@tv.first
|
219
|
+
it 'each show should return an first air date' do
|
220
|
+
expect(@tv.first.first_air_date).to eq '2005-03-26'
|
225
221
|
end
|
226
|
-
|
227
222
|
end
|
228
223
|
|
229
|
-
describe
|
230
|
-
|
224
|
+
describe 'For top rated TV shows' do
|
231
225
|
before(:each) do
|
232
226
|
VCR.use_cassette 'tv/top_rated' do
|
233
227
|
@tv = Tmdb::TV.top_rated
|
234
228
|
end
|
235
229
|
end
|
236
230
|
|
237
|
-
it
|
238
|
-
@tv.class.
|
231
|
+
it 'should return an array' do
|
232
|
+
expect(@tv.class).to eq Array
|
239
233
|
end
|
240
234
|
|
241
|
-
it
|
242
|
-
@tv.first
|
235
|
+
it 'each show should return an id' do
|
236
|
+
expect(@tv.first.id).to eq 1104
|
243
237
|
end
|
244
238
|
|
245
|
-
it
|
246
|
-
@tv.first
|
239
|
+
it 'each show should return an name' do
|
240
|
+
expect(@tv.first.name).to eq 'Mad Men'
|
247
241
|
end
|
248
242
|
|
249
|
-
it
|
250
|
-
@tv.first
|
243
|
+
it 'each show should return an original name' do
|
244
|
+
expect(@tv.first.original_name).to eq 'Mad Men'
|
251
245
|
end
|
252
246
|
|
253
|
-
it
|
254
|
-
@tv.first
|
247
|
+
it 'each show should return an popularity' do
|
248
|
+
expect(@tv.first.popularity).to eq 2.15615937122719
|
255
249
|
end
|
256
250
|
|
257
|
-
it
|
258
|
-
@tv.first
|
251
|
+
it 'each show should return an poster_path' do
|
252
|
+
expect(@tv.first.poster_path).to eq '/xA2nHrx2oHGPnL4ehBwPxD0ABvb.jpg'
|
259
253
|
end
|
260
254
|
|
261
|
-
it
|
262
|
-
@tv.first
|
255
|
+
it 'each show should return an vote_average' do
|
256
|
+
expect(@tv.first.vote_average).to eq 9.66666666666667
|
263
257
|
end
|
264
258
|
|
265
|
-
it
|
266
|
-
@tv.first
|
259
|
+
it 'each show should return an vote_count' do
|
260
|
+
expect(@tv.first.vote_count).to eq 3
|
267
261
|
end
|
268
262
|
|
269
|
-
it
|
270
|
-
@tv.first
|
263
|
+
it 'each show should return an backdrop' do
|
264
|
+
expect(@tv.first.backdrop_path).to eq '/yGW0NX3I8GXPlWPdoWWyaH0AsCk.jpg'
|
271
265
|
end
|
272
266
|
|
273
|
-
it
|
274
|
-
@tv.first
|
267
|
+
it 'each show should return an first air date' do
|
268
|
+
expect(@tv.first.first_air_date).to eq '2007-07-19'
|
275
269
|
end
|
276
|
-
|
277
270
|
end
|
278
271
|
|
279
|
-
describe
|
280
|
-
|
281
|
-
describe "For backdrops" do
|
282
|
-
|
272
|
+
describe 'For a TV shows images' do
|
273
|
+
describe 'For backdrops' do
|
283
274
|
before(:each) do
|
284
275
|
VCR.use_cassette 'tv/images' do
|
285
276
|
@backdrop = Tmdb::TV.images(1396)['backdrops'].first
|
286
277
|
end
|
287
278
|
end
|
288
279
|
|
289
|
-
it
|
290
|
-
@backdrop['aspect_ratio'].
|
280
|
+
it 'should return a aspect ratio' do
|
281
|
+
expect(@backdrop['aspect_ratio']).to eq 1.78
|
291
282
|
end
|
292
283
|
|
293
|
-
it
|
294
|
-
@backdrop['file_path'].
|
284
|
+
it 'should return a file path' do
|
285
|
+
expect(@backdrop['file_path']).to eq '/dRaV8HGx7Z9xmw77qSs8prp5OuI.jpg'
|
295
286
|
end
|
296
287
|
|
297
|
-
it
|
298
|
-
@backdrop['height'].
|
288
|
+
it 'should return a height' do
|
289
|
+
expect(@backdrop['height']).to eq 720
|
299
290
|
end
|
300
291
|
|
301
|
-
it
|
302
|
-
@backdrop['iso_639_1'].
|
292
|
+
it 'should return a iso code' do
|
293
|
+
expect(@backdrop['iso_639_1']).to eq nil
|
303
294
|
end
|
304
295
|
|
305
|
-
it
|
306
|
-
@backdrop['vote_average'].
|
296
|
+
it 'should return a vote average' do
|
297
|
+
expect(@backdrop['vote_average']).to eq 0.0
|
307
298
|
end
|
308
299
|
|
309
|
-
it
|
310
|
-
@backdrop['vote_count'].
|
300
|
+
it 'should return a vote count' do
|
301
|
+
expect(@backdrop['vote_count']).to eq 0.0
|
311
302
|
end
|
312
303
|
|
313
|
-
it
|
314
|
-
@backdrop['width'].
|
304
|
+
it 'should return a width' do
|
305
|
+
expect(@backdrop['width']).to eq 1280
|
315
306
|
end
|
316
|
-
|
317
307
|
end
|
318
308
|
|
319
|
-
describe
|
320
|
-
|
309
|
+
describe 'For posters' do
|
321
310
|
before(:each) do
|
322
311
|
VCR.use_cassette 'tv/images' do
|
323
312
|
@poster = Tmdb::TV.images(1396)['posters'].first
|
324
313
|
end
|
325
314
|
end
|
326
315
|
|
327
|
-
it
|
328
|
-
@poster['aspect_ratio'].
|
316
|
+
it 'should return a aspect ratio' do
|
317
|
+
expect(@poster['aspect_ratio']).to eq 1.0
|
329
318
|
end
|
330
319
|
|
331
|
-
it
|
332
|
-
@poster['file_path'].
|
320
|
+
it 'should return a file path' do
|
321
|
+
expect(@poster['file_path']).to eq '/lVbofIPlw3kYa8FQgHT7GtWMI2Q.jpg'
|
333
322
|
end
|
334
323
|
|
335
|
-
it
|
336
|
-
@poster['height'].
|
324
|
+
it 'should return a height' do
|
325
|
+
expect(@poster['height']).to eq 1000
|
337
326
|
end
|
338
327
|
|
339
|
-
it
|
340
|
-
@poster['iso_639_1'].
|
328
|
+
it 'should return a iso code' do
|
329
|
+
expect(@poster['iso_639_1']).to eq 'nl'
|
341
330
|
end
|
342
331
|
|
343
|
-
it
|
344
|
-
@poster['vote_average'].
|
332
|
+
it 'should return a vote average' do
|
333
|
+
expect(@poster['vote_average']).to eq 5.3125
|
345
334
|
end
|
346
335
|
|
347
|
-
it
|
348
|
-
@poster['vote_count'].
|
336
|
+
it 'should return a vote count' do
|
337
|
+
expect(@poster['vote_count']).to eq 1
|
349
338
|
end
|
350
339
|
|
351
|
-
it
|
352
|
-
@poster['width'].
|
340
|
+
it 'should return a width' do
|
341
|
+
expect(@poster['width']).to eq 1000
|
353
342
|
end
|
354
|
-
|
355
343
|
end
|
356
|
-
|
357
344
|
end
|
358
345
|
|
359
|
-
describe
|
360
|
-
|
346
|
+
describe 'For a TV shows cast' do
|
361
347
|
before(:each) do
|
362
348
|
VCR.use_cassette 'tv/cast' do
|
363
349
|
@cast = Tmdb::TV.cast(1396).first
|
364
350
|
end
|
365
351
|
end
|
366
352
|
|
367
|
-
it
|
368
|
-
@cast['id'].
|
353
|
+
it 'should return a id' do
|
354
|
+
expect(@cast['id']).to eq 17_419
|
369
355
|
end
|
370
356
|
|
371
|
-
it
|
372
|
-
@cast['name'].
|
357
|
+
it 'should return a name' do
|
358
|
+
expect(@cast['name']).to eq 'Bryan Cranston'
|
373
359
|
end
|
374
360
|
|
375
|
-
it
|
376
|
-
@cast['order'].
|
361
|
+
it 'should return a order' do
|
362
|
+
expect(@cast['order']).to eq 0
|
377
363
|
end
|
378
364
|
|
379
|
-
it
|
380
|
-
@cast['profile_path'].
|
365
|
+
it 'should return a profile image' do
|
366
|
+
expect(@cast['profile_path']).to eq '/qXWgFCk4OJqmLRUBEj7cbp8dnkx.jpg'
|
381
367
|
end
|
382
368
|
|
383
|
-
it
|
384
|
-
@cast['character'].
|
369
|
+
it 'should return a character name' do
|
370
|
+
expect(@cast['character']).to eq 'Walter White'
|
385
371
|
end
|
386
372
|
|
387
|
-
it
|
388
|
-
@cast['credit_id'].
|
373
|
+
it 'should return a credit id' do
|
374
|
+
expect(@cast['credit_id']).to eq '52542282760ee313280017f9'
|
389
375
|
end
|
390
|
-
|
391
376
|
end
|
392
377
|
|
393
|
-
describe
|
394
|
-
|
378
|
+
describe 'For a TV shows crew' do
|
395
379
|
before(:each) do
|
396
380
|
VCR.use_cassette 'tv/crew' do
|
397
381
|
@crew = Tmdb::TV.crew(1396).first
|
398
382
|
end
|
399
383
|
end
|
400
384
|
|
401
|
-
it
|
402
|
-
@crew['id'].
|
385
|
+
it 'should return a id' do
|
386
|
+
expect(@crew['id']).to eq 29_779
|
403
387
|
end
|
404
388
|
|
405
|
-
it
|
406
|
-
@crew['department'].
|
389
|
+
it 'should return a department' do
|
390
|
+
expect(@crew['department']).to eq 'Production'
|
407
391
|
end
|
408
392
|
|
409
|
-
it
|
410
|
-
@crew['job'].
|
393
|
+
it 'should return a job' do
|
394
|
+
expect(@crew['job']).to eq 'Executive Producer'
|
411
395
|
end
|
412
396
|
|
413
|
-
it
|
414
|
-
@crew['name'].
|
397
|
+
it 'should return a name' do
|
398
|
+
expect(@crew['name']).to eq 'Michelle MacLaren'
|
415
399
|
end
|
416
400
|
|
417
|
-
it
|
418
|
-
@crew['profile_path'].
|
401
|
+
it 'should return a profile image' do
|
402
|
+
expect(@crew['profile_path']).to eq nil
|
419
403
|
end
|
420
|
-
|
421
404
|
end
|
422
405
|
|
423
|
-
describe
|
424
|
-
|
406
|
+
describe 'For a TV shows external ids' do
|
425
407
|
before(:each) do
|
426
408
|
VCR.use_cassette 'tv/external_ids' do
|
427
409
|
@external = Tmdb::TV.external_ids(1396)
|
428
410
|
end
|
429
411
|
end
|
430
412
|
|
431
|
-
it
|
432
|
-
@external['id'].
|
413
|
+
it 'should return a id' do
|
414
|
+
expect(@external['id']).to eq 1396
|
433
415
|
end
|
434
416
|
|
435
|
-
it
|
436
|
-
@external['imdb_id'].
|
417
|
+
it 'should return a imdb id' do
|
418
|
+
expect(@external['imdb_id']).to eq 'tt0903747'
|
437
419
|
end
|
438
420
|
|
439
|
-
it
|
440
|
-
@external['tvdb_id'].
|
421
|
+
it 'should return a tvdb id' do
|
422
|
+
expect(@external['tvdb_id']).to eq 81_189
|
441
423
|
end
|
442
424
|
|
443
|
-
it
|
444
|
-
@external['tvrage_id'].
|
425
|
+
it 'should return a tvrage id' do
|
426
|
+
expect(@external['tvrage_id']).to eq 18_164
|
445
427
|
end
|
446
428
|
|
447
|
-
it
|
448
|
-
@external['freebase_id'].
|
429
|
+
it 'should return a freebase id' do
|
430
|
+
expect(@external['freebase_id']).to eq '/en/breaking_bad'
|
449
431
|
end
|
450
432
|
|
451
|
-
it
|
452
|
-
@external['freebase_mid'].
|
433
|
+
it 'should return a freebase mid' do
|
434
|
+
expect(@external['freebase_mid']).to eq '/m/03d34x8'
|
453
435
|
end
|
454
|
-
|
455
|
-
|
456
436
|
end
|
457
|
-
|
458
437
|
end
|