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/person_spec.rb CHANGED
@@ -1,9 +1,6 @@
1
- # encoding: utf-8
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 'For person p' do
13
+ describe "For person p" do
17
14
  before(:each) do
18
15
  @person = Tmdb::Person
19
16
  end
20
17
 
21
- it 'should return the popular people' do
22
- VCR.use_cassette 'person/popular' do
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 'should return the latest person' do
28
- VCR.use_cassette 'person/latest' do
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 'should return credits for a person ID' do
34
- VCR.use_cassette 'person/credits' do
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 'should return changes for a person ID' do
40
- VCR.use_cassette 'person/changes' do
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 'For a person detail' do
43
+ describe "For a person detail" do
47
44
  before(:each) do
48
- VCR.use_cassette 'person/detail' do
45
+ VCR.use_cassette "person/detail" do
49
46
  @person = Tmdb::Person.detail(5292)
50
47
  end
51
48
  end
52
49
 
53
- it 'should return a id' do
54
- expect(@person['id']).to eq 5292
50
+ it "should return a id" do
51
+ expect(@person["id"]).to eq 5292
55
52
  end
56
53
 
57
- it 'should return a name' do
58
- expect(@person['name']).to eq 'Denzel Washington'
54
+ it "should return a name" do
55
+ expect(@person["name"]).to eq "Denzel Washington"
59
56
  end
60
57
 
61
- it 'should return a adult' do
62
- expect(@person['adult']).to eq false
58
+ it "should return a adult" do
59
+ expect(@person["adult"]).to eq false
63
60
  end
64
61
 
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."
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 'should return a birthday' do
70
- expect(@person['birthday']).to eq '1954-12-28'
66
+ it "should return a birthday" do
67
+ expect(@person["birthday"]).to eq "1954-12-28"
71
68
  end
72
69
 
73
- it 'should return a deathday' do
74
- expect(@person['deathday']).to eq ''
70
+ it "should return a deathday" do
71
+ expect(@person["deathday"]).to eq ""
75
72
  end
76
73
 
77
- it 'should return a homepage' do
78
- expect(@person['homepage']).to eq ''
74
+ it "should return a homepage" do
75
+ expect(@person["homepage"]).to eq ""
79
76
  end
80
77
 
81
- it 'should return a place of birth' do
82
- expect(@person['place_of_birth']).to eq 'Mount Vernon, New York, USA'
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 'should return a profile path' do
86
- expect(@person['profile_path']).to eq '/khMf8LLTtppUwuZqqnigD2nAy26.jpg'
82
+ it "should return a profile path" do
83
+ expect(@person["profile_path"]).to eq "/khMf8LLTtppUwuZqqnigD2nAy26.jpg"
87
84
  end
88
85
 
89
- it 'should return an array with also known as names' do
90
- expect(@person['also_known_as']).to eq []
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 'For a person detail with appended response' do
95
- let(:append_fields) { %w( movie_credits tv_credits combined_credits images changes ).join(',') }
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 'person/detail_with_appended_response' do
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 'should return movie credits' do
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
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 'should return tv credits' do
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
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 'should return combined credits' do
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
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 'should return images' do
125
- expect(@person['images']['profiles'].size).to eq 6
126
- expect(@person['images']['profiles'].first['file_path']).to eq '/khMf8LLTtppUwuZqqnigD2nAy26.jpg'
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 'should return changes' do
130
- expect(@person['changes']['changes']).to eq []
126
+ it "should return changes" do
127
+ expect(@person["changes"]["changes"]).to eq []
131
128
  end
132
129
  end
133
130
 
134
- describe 'For images of a person' do
131
+ describe "For images of a person" do
135
132
  before(:each) do
136
- VCR.use_cassette 'person/images' do
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 'should return profiles' do
142
- @person_images['profiles'].length == 6
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
- # 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
1
+ # frozen_string_literal: true
7
2
 
8
- require_relative '../lib/themoviedb.rb'
9
- require 'vcr'
3
+ require "themoviedb"
4
+ require "vcr"
10
5
 
11
- $VALID_API_KEY = '8a221fc31fcdf12a8af827465574ffc9'
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 = 'spec/vcr'
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
- config.run_all_when_everything_filtered = true
23
- config.filter_run :focus
17
+ # Enable flags like --only-failures and --next-failure
18
+ config.example_status_persistence_file_path = ".rspec_status"
24
19
 
25
- # Run specs in random order to surface order dependencies. If you find an
26
- # order dependency and want to debug it, you can fix the order by providing
27
- # the seed, which is printed after each run.
28
- # --seed 1234
29
- config.order = 'random'
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