themoviedb 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/spec/company_spec.rb CHANGED
@@ -1,8 +1,6 @@
1
- require 'rspec'
2
- require 'spec_helper'
3
- require 'vcr'
1
+ require "spec_helper"
4
2
 
5
- describe Tmdb::Company do
3
+ RSpec.describe Tmdb::Company do
6
4
  @fields = [
7
5
  :description,
8
6
  :headquarters,
@@ -17,76 +15,76 @@ describe Tmdb::Company do
17
15
  it { should respond_to field }
18
16
  end
19
17
 
20
- describe 'For a company detail' do
18
+ describe "For a company detail" do
21
19
  before(:each) do
22
- VCR.use_cassette 'company/detail' do
20
+ VCR.use_cassette "company/detail" do
23
21
  @company = Tmdb::Company.detail(5)
24
22
  end
25
23
  end
26
24
 
27
- it 'should return a id' do
28
- expect(@company['id']).to eq(5)
25
+ it "should return a id" do
26
+ expect(@company["id"]).to eq(5)
29
27
  end
30
28
 
31
- it 'should have a description' do
32
- expect(@company['description']).to eq("Columbia Pictures Industries, Inc. (CPII) is an American film production and distribution company. Columbia Pictures now forms part of the Columbia TriStar Motion Picture Group, owned by Sony Pictures Entertainment, a subsidiary of the Japanese conglomerate Sony. It is one of the leading film companies in the world, a member of the so-called Big Six. It was one of the so-called Little Three among the eight major film studios of Hollywood's Golden Age.")
29
+ it "should have a description" do
30
+ expect(@company["description"]).to eq("Columbia Pictures Industries, Inc. (CPII) is an American film production and distribution company. Columbia Pictures now forms part of the Columbia TriStar Motion Picture Group, owned by Sony Pictures Entertainment, a subsidiary of the Japanese conglomerate Sony. It is one of the leading film companies in the world, a member of the so-called Big Six. It was one of the so-called Little Three among the eight major film studios of Hollywood's Golden Age.")
33
31
  end
34
32
 
35
- it 'should have a homepage' do
36
- expect(@company['homepage']).to eq('http://www.sonypictures.com/')
33
+ it "should have a homepage" do
34
+ expect(@company["homepage"]).to eq("http://www.sonypictures.com/")
37
35
  end
38
36
 
39
- it 'should have logo' do
40
- expect(@company['logo_path']).to eq('/mjUSfXXUhMiLAA1Zq1TfStNSoLR.png')
37
+ it "should have logo" do
38
+ expect(@company["logo_path"]).to eq("/mjUSfXXUhMiLAA1Zq1TfStNSoLR.png")
41
39
  end
42
40
 
43
- it 'should have a name' do
44
- expect(@company['name']).to eq('Columbia Pictures')
41
+ it "should have a name" do
42
+ expect(@company["name"]).to eq("Columbia Pictures")
45
43
  end
46
44
 
47
- it 'could have a parent company' do
48
- expect(@company['parent_company']['name']).to eq('Sony Pictures Entertainment')
45
+ it "could have a parent company" do
46
+ expect(@company["parent_company"]["name"]).to eq("Sony Pictures Entertainment")
49
47
  end
50
48
  end
51
49
 
52
- describe 'For a company movies' do
50
+ describe "For a company movies" do
53
51
  before(:each) do
54
- VCR.use_cassette 'company/movies' do
52
+ VCR.use_cassette "company/movies" do
55
53
  @movies = Tmdb::Company.movies(5)
56
54
  @movie = @movies.first
57
55
  end
58
56
  end
59
57
 
60
- it 'should give back multiple movies' do
58
+ it "should give back multiple movies" do
61
59
  expect(@movies.count).to be > 1
62
60
  end
63
61
 
64
- it 'should have a id' do
62
+ it "should have a id" do
65
63
  expect(@movie.id).to eq(97_020)
66
64
  end
67
65
 
68
- it 'should have a title' do
69
- expect(@movie.title).to eq('RoboCop')
66
+ it "should have a title" do
67
+ expect(@movie.title).to eq("RoboCop")
70
68
  end
71
69
 
72
- it 'should have a original title' do
73
- expect(@movie.original_title).to eq('RoboCop')
70
+ it "should have a original title" do
71
+ expect(@movie.original_title).to eq("RoboCop")
74
72
  end
75
73
 
76
- it 'should have a poster' do
77
- expect(@movie.poster_path).to eq('/xxLhczZMiJt1iRdhfkVkuMu87si.jpg')
74
+ it "should have a poster" do
75
+ expect(@movie.poster_path).to eq("/xxLhczZMiJt1iRdhfkVkuMu87si.jpg")
78
76
  end
79
77
 
80
- it 'should have a popularity rating' do
78
+ it "should have a popularity rating" do
81
79
  expect(@movie.popularity).to eq(3.13451193740971)
82
80
  end
83
81
 
84
- it 'should show whether it is an adult movie' do
82
+ it "should show whether it is an adult movie" do
85
83
  expect(@movie.adult).to eq(false)
86
84
  end
87
85
 
88
- it 'should have a release date' do
89
- expect(@movie.release_date).to eq('2014-02-07')
86
+ it "should have a release date" do
87
+ expect(@movie.release_date).to eq("2014-02-07")
90
88
  end
91
89
  end
92
90
  end
data/spec/find_spec.rb CHANGED
@@ -1,27 +1,25 @@
1
- require 'rspec'
2
- require 'spec_helper'
3
- require 'vcr'
1
+ require "spec_helper"
4
2
 
5
- describe Tmdb::Find do
6
- describe 'For a search' do
3
+ RSpec.describe Tmdb::Find do
4
+ describe "For a search" do
7
5
  before(:each) do
8
6
  @find = Tmdb::Find
9
7
  end
10
8
 
11
- it 'should return results for imdb_id' do
12
- VCR.use_cassette 'find/search_imdb' do
13
- find = @find.imdb_id('tt1375666')
14
- expect(find['movie_results']).to be_truthy
15
- expect(find['person_results']).to be_truthy
16
- expect(find['tv_results']).to be_truthy
9
+ it "should return results for imdb_id" do
10
+ VCR.use_cassette "find/search_imdb" do
11
+ find = @find.imdb_id("tt1375666")
12
+ expect(find["movie_results"]).to be_truthy
13
+ expect(find["person_results"]).to be_truthy
14
+ expect(find["tv_results"]).to be_truthy
17
15
  end
18
16
  end
19
17
 
20
- it 'should return results for tvdb_id' do
21
- VCR.use_cassette 'find/search_tvdb' do
22
- find = @find.tvdb_id('81189')
23
- expect(find['tv_results'].first['name']).to eq 'Breaking Bad'
24
- expect(find['tv_results']).to be_truthy
18
+ it "should return results for tvdb_id" do
19
+ VCR.use_cassette "find/search_tvdb" do
20
+ find = @find.tvdb_id("81189")
21
+ expect(find["tv_results"].first["name"]).to eq "Breaking Bad"
22
+ expect(find["tv_results"]).to be_truthy
25
23
  end
26
24
  end
27
25
  end
@@ -1,24 +1,23 @@
1
- require 'rspec'
2
- require 'spec_helper'
1
+ require "spec_helper"
3
2
 
4
- describe 'invalid API key' do
3
+ RSpec.describe "invalid API key" do
5
4
  after(:all) { Tmdb::Api.key($VALID_API_KEY) }
6
- it 'raises error for nil key' do
5
+ it "raises error for nil key" do
7
6
  Tmdb::Api.key(nil)
8
- VCR.use_cassette 'api_key/nil_key' do
9
- expect { Tmdb::Movie.search('batman') }.to raise_error(Tmdb::InvalidApiKeyError)
7
+ VCR.use_cassette "api_key/nil_key" do
8
+ expect { Tmdb::Movie.search("batman") }.to raise_error(Tmdb::InvalidApiKeyError)
10
9
  end
11
10
  end
12
- it 'raises error for empty string key' do
13
- Tmdb::Api.key('')
14
- VCR.use_cassette 'api_key/empty_string' do
15
- expect { Tmdb::Movie.search('batman') }.to raise_error(Tmdb::InvalidApiKeyError)
11
+ it "raises error for empty string key" do
12
+ Tmdb::Api.key("")
13
+ VCR.use_cassette "api_key/empty_string" do
14
+ expect { Tmdb::Movie.search("batman") }.to raise_error(Tmdb::InvalidApiKeyError)
16
15
  end
17
16
  end
18
- it 'raises error invalid nonempty key' do
19
- Tmdb::Api.key('bad-key')
20
- VCR.use_cassette 'api_key/invalid_key' do
21
- expect { Tmdb::Movie.search('batman') }.to raise_error(Tmdb::InvalidApiKeyError)
17
+ it "raises error invalid nonempty key" do
18
+ Tmdb::Api.key("bad-key")
19
+ VCR.use_cassette "api_key/invalid_key" do
20
+ expect { Tmdb::Movie.search("batman") }.to raise_error(Tmdb::InvalidApiKeyError)
22
21
  end
23
22
  end
24
23
  end
@@ -0,0 +1,66 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Tmdb::Keyword do
4
+ @fields = [:id, :name]
5
+
6
+ @fields.each do |field|
7
+ it { should respond_to field }
8
+ end
9
+
10
+ describe "For a keyword detail" do
11
+ before(:each) do
12
+ VCR.use_cassette "keyword/detail" do
13
+ @keyword = Tmdb::Keyword.detail(818)
14
+ end
15
+ end
16
+
17
+ it "should return a id" do
18
+ expect(@keyword["id"]).to eq 818
19
+ end
20
+
21
+ it "should return a name" do
22
+ expect(@keyword["name"]).to eq "based on novel"
23
+ end
24
+ end
25
+
26
+ describe "For a keyword movies" do
27
+ before(:each) do
28
+ VCR.use_cassette "keyword/movies_for_id" do
29
+ @movies = Tmdb::Keyword.movies(818)
30
+ @movie = @movies.first
31
+ end
32
+ end
33
+
34
+ it "should give back multiple movies" do
35
+ expect(@movies.count).to be > 1
36
+ end
37
+
38
+ it "should have a id" do
39
+ expect(@movie.id).to eq(341_174)
40
+ end
41
+
42
+ it "should have a title" do
43
+ expect(@movie.title).to eq("Fifty Shades Darker")
44
+ end
45
+
46
+ it "should have a original title" do
47
+ expect(@movie.original_title).to eq("Fifty Shades Darker")
48
+ end
49
+
50
+ it "should have a poster" do
51
+ expect(@movie.poster_path).to eq("/7SMCz5724COOYDhY0mj0NfcJqxH.jpg")
52
+ end
53
+
54
+ it "should have a popularity rating" do
55
+ expect(@movie.popularity).to eq(208.414524)
56
+ end
57
+
58
+ it "should show whether it is an adult movie" do
59
+ expect(@movie.adult).to eq(false)
60
+ end
61
+
62
+ it "should have a release date" do
63
+ expect(@movie.release_date).to eq("2017-02-08")
64
+ end
65
+ end
66
+ end