themoviedb 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +10 -5
- data/lib/themoviedb/api.rb +5 -5
- data/lib/themoviedb/collection.rb +1 -1
- data/lib/themoviedb/company.rb +1 -1
- data/lib/themoviedb/configuration.rb +8 -8
- data/lib/themoviedb/episode.rb +3 -3
- data/lib/themoviedb/find.rb +6 -6
- data/lib/themoviedb/genre.rb +5 -5
- data/lib/themoviedb/job.rb +1 -1
- data/lib/themoviedb/keyword.rb +20 -0
- data/lib/themoviedb/movie.rb +15 -9
- data/lib/themoviedb/person.rb +3 -3
- data/lib/themoviedb/resource.rb +1 -1
- data/lib/themoviedb/search.rb +22 -20
- data/lib/themoviedb/season.rb +3 -3
- data/lib/themoviedb/tv.rb +6 -6
- data/lib/themoviedb/version.rb +2 -1
- data/lib/themoviedb.rb +6 -6
- data/spec/company_spec.rb +30 -32
- data/spec/find_spec.rb +14 -16
- data/spec/invalid_api_key_spec.rb +13 -14
- data/spec/keyword_spec.rb +66 -0
- data/spec/movie_spec.rb +134 -133
- data/spec/person_spec.rb +60 -63
- data/spec/spec_helper.rb +13 -17
- data/spec/tv_spec.rb +175 -177
- data/spec/vcr/keyword/detail.yml +56 -0
- data/spec/vcr/keyword/movies_for_id.yml +334 -0
- data/spec/vcr/movie/detail.yml +22 -56
- data/themoviedb.gemspec +1 -7
- metadata +50 -100
data/spec/person_spec.rb
CHANGED
@@ -1,9 +1,6 @@
|
|
1
|
-
|
2
|
-
require 'rspec'
|
3
|
-
require 'spec_helper'
|
4
|
-
require 'vcr'
|
1
|
+
require "spec_helper"
|
5
2
|
|
6
|
-
describe Tmdb::Person do
|
3
|
+
RSpec.describe Tmdb::Person do
|
7
4
|
@fields = [:id, :name, :place_of_birth, :also_known_as,
|
8
5
|
:adult, :biography, :birthday, :deathday, :homepage,
|
9
6
|
:profile_path, :movie_credits, :tv_credits, :combined_credits,
|
@@ -13,133 +10,133 @@ describe Tmdb::Person do
|
|
13
10
|
it { should respond_to field }
|
14
11
|
end
|
15
12
|
|
16
|
-
describe
|
13
|
+
describe "For person p" do
|
17
14
|
before(:each) do
|
18
15
|
@person = Tmdb::Person
|
19
16
|
end
|
20
17
|
|
21
|
-
it
|
22
|
-
VCR.use_cassette
|
18
|
+
it "should return the popular people" do
|
19
|
+
VCR.use_cassette "person/popular" do
|
23
20
|
expect(@person.popular).to be_truthy
|
24
21
|
end
|
25
22
|
end
|
26
23
|
|
27
|
-
it
|
28
|
-
VCR.use_cassette
|
24
|
+
it "should return the latest person" do
|
25
|
+
VCR.use_cassette "person/latest" do
|
29
26
|
expect(@person.latest).to be_truthy
|
30
27
|
end
|
31
28
|
end
|
32
29
|
|
33
|
-
it
|
34
|
-
VCR.use_cassette
|
30
|
+
it "should return credits for a person ID" do
|
31
|
+
VCR.use_cassette "person/credits" do
|
35
32
|
expect(@person.credits(5292)).to be_truthy
|
36
33
|
end
|
37
34
|
end
|
38
35
|
|
39
|
-
it
|
40
|
-
VCR.use_cassette
|
36
|
+
it "should return changes for a person ID" do
|
37
|
+
VCR.use_cassette "person/changes" do
|
41
38
|
expect(@person.changes(5292)).to be_truthy
|
42
39
|
end
|
43
40
|
end
|
44
41
|
end
|
45
42
|
|
46
|
-
describe
|
43
|
+
describe "For a person detail" do
|
47
44
|
before(:each) do
|
48
|
-
VCR.use_cassette
|
45
|
+
VCR.use_cassette "person/detail" do
|
49
46
|
@person = Tmdb::Person.detail(5292)
|
50
47
|
end
|
51
48
|
end
|
52
49
|
|
53
|
-
it
|
54
|
-
expect(@person[
|
50
|
+
it "should return a id" do
|
51
|
+
expect(@person["id"]).to eq 5292
|
55
52
|
end
|
56
53
|
|
57
|
-
it
|
58
|
-
expect(@person[
|
54
|
+
it "should return a name" do
|
55
|
+
expect(@person["name"]).to eq "Denzel Washington"
|
59
56
|
end
|
60
57
|
|
61
|
-
it
|
62
|
-
expect(@person[
|
58
|
+
it "should return a adult" do
|
59
|
+
expect(@person["adult"]).to eq false
|
63
60
|
end
|
64
61
|
|
65
|
-
it
|
66
|
-
expect(@person[
|
62
|
+
it "should return a biography" do
|
63
|
+
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
64
|
end
|
68
65
|
|
69
|
-
it
|
70
|
-
expect(@person[
|
66
|
+
it "should return a birthday" do
|
67
|
+
expect(@person["birthday"]).to eq "1954-12-28"
|
71
68
|
end
|
72
69
|
|
73
|
-
it
|
74
|
-
expect(@person[
|
70
|
+
it "should return a deathday" do
|
71
|
+
expect(@person["deathday"]).to eq ""
|
75
72
|
end
|
76
73
|
|
77
|
-
it
|
78
|
-
expect(@person[
|
74
|
+
it "should return a homepage" do
|
75
|
+
expect(@person["homepage"]).to eq ""
|
79
76
|
end
|
80
77
|
|
81
|
-
it
|
82
|
-
expect(@person[
|
78
|
+
it "should return a place of birth" do
|
79
|
+
expect(@person["place_of_birth"]).to eq "Mount Vernon, New York, USA"
|
83
80
|
end
|
84
81
|
|
85
|
-
it
|
86
|
-
expect(@person[
|
82
|
+
it "should return a profile path" do
|
83
|
+
expect(@person["profile_path"]).to eq "/khMf8LLTtppUwuZqqnigD2nAy26.jpg"
|
87
84
|
end
|
88
85
|
|
89
|
-
it
|
90
|
-
expect(@person[
|
86
|
+
it "should return an array with also known as names" do
|
87
|
+
expect(@person["also_known_as"]).to eq []
|
91
88
|
end
|
92
89
|
end
|
93
90
|
|
94
|
-
describe
|
95
|
-
let(:append_fields) { %w
|
91
|
+
describe "For a person detail with appended response" do
|
92
|
+
let(:append_fields) { %w[ movie_credits tv_credits combined_credits images changes ].join(",") }
|
96
93
|
|
97
94
|
before(:each) do
|
98
|
-
VCR.use_cassette
|
95
|
+
VCR.use_cassette "person/detail_with_appended_response" do
|
99
96
|
@person = Tmdb::Person.detail(5292, append_to_response: append_fields)
|
100
97
|
end
|
101
98
|
end
|
102
99
|
|
103
|
-
it
|
104
|
-
expect(@person[
|
105
|
-
expect(@person[
|
106
|
-
expect(@person[
|
107
|
-
expect(@person[
|
100
|
+
it "should return movie credits" do
|
101
|
+
expect(@person["movie_credits"]["cast"].size).to eq 47
|
102
|
+
expect(@person["movie_credits"]["cast"].first["id"]).to eq 388
|
103
|
+
expect(@person["movie_credits"]["crew"].size).to eq 4
|
104
|
+
expect(@person["movie_credits"]["crew"].first["id"]).to eq 13_435
|
108
105
|
end
|
109
106
|
|
110
|
-
it
|
111
|
-
expect(@person[
|
112
|
-
expect(@person[
|
113
|
-
expect(@person[
|
114
|
-
expect(@person[
|
107
|
+
it "should return tv credits" do
|
108
|
+
expect(@person["tv_credits"]["cast"].size).to eq 17
|
109
|
+
expect(@person["tv_credits"]["cast"].first["id"]).to eq 1709
|
110
|
+
expect(@person["tv_credits"]["crew"].size).to eq 3
|
111
|
+
expect(@person["tv_credits"]["crew"].first["id"]).to eq 18_881
|
115
112
|
end
|
116
113
|
|
117
|
-
it
|
118
|
-
expect(@person[
|
119
|
-
expect(@person[
|
120
|
-
expect(@person[
|
121
|
-
expect(@person[
|
114
|
+
it "should return combined credits" do
|
115
|
+
expect(@person["combined_credits"]["cast"].size).to eq 64
|
116
|
+
expect(@person["combined_credits"]["cast"].first["id"]).to eq 388
|
117
|
+
expect(@person["combined_credits"]["crew"].size).to eq 7
|
118
|
+
expect(@person["combined_credits"]["crew"].first["id"]).to eq 13_435
|
122
119
|
end
|
123
120
|
|
124
|
-
it
|
125
|
-
expect(@person[
|
126
|
-
expect(@person[
|
121
|
+
it "should return images" do
|
122
|
+
expect(@person["images"]["profiles"].size).to eq 6
|
123
|
+
expect(@person["images"]["profiles"].first["file_path"]).to eq "/khMf8LLTtppUwuZqqnigD2nAy26.jpg"
|
127
124
|
end
|
128
125
|
|
129
|
-
it
|
130
|
-
expect(@person[
|
126
|
+
it "should return changes" do
|
127
|
+
expect(@person["changes"]["changes"]).to eq []
|
131
128
|
end
|
132
129
|
end
|
133
130
|
|
134
|
-
describe
|
131
|
+
describe "For images of a person" do
|
135
132
|
before(:each) do
|
136
|
-
VCR.use_cassette
|
133
|
+
VCR.use_cassette "person/images" do
|
137
134
|
@person_images = Tmdb::Person.images(5292)
|
138
135
|
end
|
139
136
|
end
|
140
137
|
|
141
|
-
it
|
142
|
-
@person_images[
|
138
|
+
it "should return profiles" do
|
139
|
+
@person_images["profiles"].length == 6
|
143
140
|
end
|
144
141
|
end
|
145
142
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,30 +1,26 @@
|
|
1
|
-
#
|
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
|
1
|
+
# frozen_string_literal: true
|
7
2
|
|
8
|
-
|
9
|
-
require
|
3
|
+
require "themoviedb"
|
4
|
+
require "vcr"
|
10
5
|
|
11
|
-
$VALID_API_KEY =
|
6
|
+
$VALID_API_KEY = "8a221fc31fcdf12a8af827465574ffc9"
|
12
7
|
Tmdb::Api.key($VALID_API_KEY)
|
13
8
|
|
14
9
|
VCR.configure do |c|
|
15
10
|
# the directory where your cassettes will be saved
|
16
|
-
c.cassette_library_dir =
|
11
|
+
c.cassette_library_dir = "spec/vcr"
|
17
12
|
# your HTTP request service. You can also use fakeweb, webmock, and more
|
18
13
|
c.hook_into :webmock
|
19
14
|
end
|
20
15
|
|
21
16
|
RSpec.configure do |config|
|
22
|
-
|
23
|
-
config.
|
17
|
+
# Enable flags like --only-failures and --next-failure
|
18
|
+
config.example_status_persistence_file_path = ".rspec_status"
|
24
19
|
|
25
|
-
#
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
20
|
+
# Disable RSpec exposing methods globally on `Module` and `main`
|
21
|
+
config.disable_monkey_patching!
|
22
|
+
|
23
|
+
config.expect_with :rspec do |c|
|
24
|
+
c.syntax = :expect
|
25
|
+
end
|
30
26
|
end
|