themoviedb 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +459 -0
  3. data/lib/themoviedb.rb +4 -5
  4. data/lib/themoviedb/api.rb +4 -5
  5. data/lib/themoviedb/collection.rb +6 -7
  6. data/lib/themoviedb/company.rb +7 -8
  7. data/lib/themoviedb/configuration.rb +2 -2
  8. data/lib/themoviedb/episode.rb +16 -17
  9. data/lib/themoviedb/find.rb +11 -12
  10. data/lib/themoviedb/genre.rb +53 -57
  11. data/lib/themoviedb/job.rb +3 -5
  12. data/lib/themoviedb/movie.rb +62 -63
  13. data/lib/themoviedb/person.rb +37 -33
  14. data/lib/themoviedb/resource.rb +19 -21
  15. data/lib/themoviedb/search.rb +30 -30
  16. data/lib/themoviedb/season.rb +16 -17
  17. data/lib/themoviedb/tv.rb +24 -25
  18. data/lib/themoviedb/version.rb +2 -1
  19. data/spec/company_spec.rb +31 -36
  20. data/spec/find_spec.rb +10 -13
  21. data/spec/movie_spec.rb +124 -129
  22. data/spec/person_spec.rb +53 -53
  23. data/spec/spec/vcr/find/search_imdb.yml +39 -0
  24. data/spec/spec_helper.rb +29 -0
  25. data/spec/tv_spec.rb +196 -217
  26. data/spec/vcr/company/detail.yml +67 -0
  27. data/spec/vcr/company/movies.yml +98 -0
  28. data/spec/vcr/find/search_imdb.yml +50 -0
  29. data/spec/vcr/find/search_tvdb.yml +52 -0
  30. data/spec/vcr/movie/alternative_titles_for_id.yml +69 -0
  31. data/spec/vcr/movie/cast_information_for_id.yml +109 -0
  32. data/spec/vcr/movie/changes_made.yml +60 -0
  33. data/spec/vcr/movie/credits_for_id.yml +99 -0
  34. data/spec/vcr/movie/crew_for_id.yml +109 -0
  35. data/spec/vcr/movie/detail.yml +93 -0
  36. data/spec/vcr/movie/detail_with_appended_response.yml +254 -0
  37. data/spec/vcr/movie/images.yml +62 -0
  38. data/spec/vcr/movie/keywords_for_id.yml +62 -0
  39. data/spec/vcr/movie/language_german.yml +112 -0
  40. data/spec/vcr/movie/movie_belongs_for_id.yml +89 -0
  41. data/spec/vcr/movie/now_playing.yml +90 -0
  42. data/spec/vcr/movie/popular.yml +96 -0
  43. data/spec/vcr/movie/releases_for_id.yml +60 -0
  44. data/spec/vcr/movie/return_latest_movie.yml +62 -0
  45. data/spec/vcr/movie/return_upcoming_movie.yml +186 -0
  46. data/spec/vcr/movie/similar_for_id.yml +180 -0
  47. data/spec/vcr/movie/top_rated.yml +190 -0
  48. data/spec/vcr/movie/trailers_for_id.yml +60 -0
  49. data/spec/vcr/movie/translations_for_id.yml +76 -0
  50. data/spec/vcr/person/changes.yml +50 -0
  51. data/spec/vcr/person/credits.yml +459 -0
  52. data/spec/vcr/person/detail.yml +65 -0
  53. data/spec/vcr/person/detail_with_appended_response.yml +762 -0
  54. data/spec/vcr/person/images.yml +50 -0
  55. data/spec/vcr/person/latest.yml +51 -0
  56. data/spec/vcr/person/popular.yml +125 -0
  57. data/spec/vcr/tv/cast.yml +74 -0
  58. data/spec/vcr/tv/crew.yml +74 -0
  59. data/spec/vcr/tv/detail.yml +63 -0
  60. data/spec/vcr/tv/detail_with_appeded_response.yml +76 -0
  61. data/spec/vcr/tv/external_ids.yml +60 -0
  62. data/spec/vcr/tv/images.yml +121 -0
  63. data/spec/vcr/tv/popular.yml +96 -0
  64. data/spec/vcr/tv/test_chuck.yml +52 -0
  65. data/spec/vcr/tv/top_rated.yml +84 -0
  66. data/themoviedb.gemspec +10 -35
  67. metadata +94 -9
@@ -1,8 +1,8 @@
1
1
  module Tmdb
2
2
  class Person < Resource
3
- has_resource 'person', :plural => 'people'
3
+ has_resource 'person', plural: 'people'
4
4
 
5
- #http://docs.themoviedb.apiary.io/#people
5
+ # http://docs.themoviedb.apiary.io/#people
6
6
  @@fields = [
7
7
  :adult,
8
8
  :also_known_as,
@@ -11,6 +11,7 @@ module Tmdb
11
11
  :deathday,
12
12
  :homepage,
13
13
  :id,
14
+ :known_for,
14
15
  :name,
15
16
  :place_of_birth,
16
17
  :profile_path,
@@ -25,62 +26,65 @@ module Tmdb
25
26
  attr_accessor field
26
27
  end
27
28
 
28
- #Get the list of popular people on The Movie Database. This list refreshes every day.
29
+ # Get the list of popular people on The Movie Database. This list refreshes every day.
29
30
  def self.popular
30
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/popular")
31
- search.fetch
31
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/popular")
32
+ search.fetch.collect do |result|
33
+ next unless result['known_for']
34
+ result['known_for'] = result['known_for'].collect { |movie| Tmdb::Movie.new(movie) }
35
+ new(result)
36
+ end
32
37
  end
33
38
 
34
- #Get the latest person id.
39
+ # Get the latest person id.
35
40
  def self.latest
36
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/latest")
37
- search.fetch_response
41
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/latest")
42
+ person = new(search.fetch_response)
38
43
  end
39
44
 
40
- #Get the combined credits for a specific person id.
41
- def self.credits(id, conditions={})
42
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/combined_credits")
45
+ # Get the combined credits for a specific person id.
46
+ def self.credits(id, _conditions = {})
47
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/combined_credits")
43
48
  search.fetch_response
44
49
  end
45
50
 
46
- #Get film credits for a specific person id.
47
- def self.movie_credits(id, conditions={})
48
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/movie_credits")
51
+ # Get film credits for a specific person id.
52
+ def self.movie_credits(id, _conditions = {})
53
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/movie_credits")
49
54
  search.fetch_response
50
55
  end
51
56
 
52
- #Get TV credits for a specific person id.
53
- def self.tv_credits(id, conditions={})
54
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/tv_credits")
57
+ # Get TV credits for a specific person id.
58
+ def self.tv_credits(id, _conditions = {})
59
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/tv_credits")
55
60
  search.fetch_response
56
61
  end
57
62
 
58
- #Get external ID's for a specific person id.
59
- def self.external_ids(id, conditions={})
60
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/external_ids")
63
+ # Get external ID's for a specific person id.
64
+ def self.external_ids(id, _conditions = {})
65
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/external_ids")
61
66
  search.fetch_response
62
67
  end
63
68
 
64
- #Get the images for a specific person id.
65
- def self.images(id, conditions={})
66
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/images")
69
+ # Get the images for a specific person id.
70
+ def self.images(id, _conditions = {})
71
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/images")
67
72
  search.fetch_response
68
73
  end
69
74
 
70
- #Get the tagged images for a specific person id.
71
- def self.tagged_images(id, conditions={})
72
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/tagged_images")
75
+ # Get the tagged images for a specific person id.
76
+ def self.tagged_images(id, _conditions = {})
77
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/tagged_images")
73
78
  search.fetch_response
74
79
  end
75
80
 
76
- #Get the changes for a specific person id.
77
- #Changes are grouped by key, and ordered by date in descending order.
78
- #By default, only the last 24 hours of changes are returned.
79
- #The maximum number of days that can be returned in a single request is 14. The language is present on fields that are translatable.
80
- def self.changes(id, conditions={})
81
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/changes")
81
+ # Get the changes for a specific person id.
82
+ # Changes are grouped by key, and ordered by date in descending order.
83
+ # By default, only the last 24 hours of changes are returned.
84
+ # The maximum number of days that can be returned in a single request is 14. The language is present on fields that are translatable.
85
+ def self.changes(id, _conditions = {})
86
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/changes")
82
87
  search.fetch_response
83
88
  end
84
-
85
89
  end
86
90
  end
@@ -3,56 +3,54 @@ module Tmdb
3
3
  @@endpoints = {}
4
4
  @@endpoint_id = {}
5
5
 
6
- def self.has_resource(singular=nil, opts={})
7
- @@endpoints[self.name.downcase] = {
8
- :singular => singular.nil? ? "#{self.name.downcase}" : singular,
9
- :plural => opts[:plural].nil? ? "#{self.name.downcase}s" : opts[:plural]
6
+ def self.has_resource(singular = nil, opts = {})
7
+ @@endpoints[name.downcase] = {
8
+ singular: singular.nil? ? name.downcase.to_s : singular,
9
+ plural: opts[:plural].nil? ? "#{name.downcase}s" : opts[:plural]
10
10
  }
11
- @@endpoint_id[self.name.downcase] = opts[:id].nil? ? "" : "#{opts[:id]}-"
11
+ @@endpoint_id[name.downcase] = opts[:id].nil? ? '' : "#{opts[:id]}-"
12
12
  end
13
13
 
14
14
  def self.endpoints
15
- @@endpoints[self.name.downcase]
15
+ @@endpoints[name.downcase]
16
16
  end
17
17
 
18
18
  def self.endpoint_id
19
- @@endpoint_id[self.name.downcase]
19
+ @@endpoint_id[name.downcase]
20
20
  end
21
21
 
22
- #Get the basic resource information for a specific id.
23
- def self.detail(id, conditions={})
24
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}")
22
+ # Get the basic resource information for a specific id.
23
+ def self.detail(id, conditions = {})
24
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}")
25
25
  search.filter(conditions)
26
26
  search.fetch_response
27
27
  end
28
28
 
29
- def self.list(conditions={})
30
- search = Tmdb::Search.new("/#{self.endpoints[:plural]}")
29
+ def self.list(conditions = {})
30
+ search = Tmdb::Search.new("/#{endpoints[:plural]}")
31
31
  search.filter(conditions)
32
32
  search.fetch.collect do |result|
33
- self.new(result)
33
+ new(result)
34
34
  end
35
35
  end
36
36
 
37
37
  def self.search(query)
38
38
  search = Tmdb::Search.new
39
- search.resource("#{self.endpoints[:singular]}")
39
+ search.resource(endpoints[:singular].to_s)
40
40
  search.query(query)
41
41
  search.fetch.collect do |result|
42
- self.new(result)
42
+ new(result)
43
43
  end
44
44
  end
45
45
 
46
46
  class << self
47
- alias_method :find, :search
47
+ alias find search
48
48
  end
49
49
 
50
- def initialize(attributes={})
50
+ def initialize(attributes = {})
51
51
  attributes.each do |key, value|
52
- if self.respond_to?(key.to_sym)
53
- self.instance_variable_set("@#{key}", value)
54
- end
52
+ instance_variable_set("@#{key}", value) if respond_to?(key.to_sym)
55
53
  end
56
54
  end
57
55
  end
58
- end
56
+ end
@@ -1,44 +1,44 @@
1
1
  module Tmdb
2
2
  class Search
3
- def initialize(resource=nil)
3
+ def initialize(resource = nil)
4
4
  @params = {}
5
5
  @resource = resource.nil? ? '/search/movie' : resource
6
6
  self
7
7
  end
8
8
 
9
9
  def query(query)
10
- @params[:query] = "#{query}"
10
+ @params[:query] = query.to_s
11
11
  self
12
12
  end
13
13
 
14
14
  def year(year)
15
- @params[:year] = "#{year}"
15
+ @params[:year] = year.to_s
16
16
  self
17
17
  end
18
18
 
19
19
  def primary_realease_year(year)
20
- @params[:primary_release_year] = "#{year}"
20
+ @params[:primary_release_year] = year.to_s
21
21
  self
22
22
  end
23
23
 
24
24
  def resource(resource)
25
25
  @resource = case resource
26
- when 'movie'
27
- '/search/movie'
28
- when 'collection'
29
- '/search/collection'
30
- when 'tv'
31
- '/search/tv'
32
- when 'person'
33
- '/search/person'
34
- when 'list'
35
- '/search/list'
36
- when 'company'
37
- '/search/company'
38
- when 'keyword'
39
- '/search/keyword'
40
- when 'find'
41
- '/find'
26
+ when 'movie'
27
+ '/search/movie'
28
+ when 'collection'
29
+ '/search/collection'
30
+ when 'tv'
31
+ '/search/tv'
32
+ when 'person'
33
+ '/search/person'
34
+ when 'list'
35
+ '/search/list'
36
+ when 'company'
37
+ '/search/company'
38
+ when 'keyword'
39
+ '/search/keyword'
40
+ when 'find'
41
+ '/find'
42
42
  end
43
43
  self
44
44
  end
@@ -46,8 +46,8 @@ module Tmdb
46
46
  def filter(conditions)
47
47
  if conditions
48
48
  conditions.each do |key, value|
49
- if self.respond_to?(key)
50
- self.send(key, value)
49
+ if respond_to?(key)
50
+ send(key, value)
51
51
  else
52
52
  @params[key] = value
53
53
  end
@@ -55,25 +55,25 @@ module Tmdb
55
55
  end
56
56
  end
57
57
 
58
- #Sends back main data
58
+ # Sends back main data
59
59
  def fetch
60
60
  fetch_response['results']
61
61
  end
62
62
 
63
- #Send back whole response
64
- def fetch_response(conditions={})
63
+ # Send back whole response
64
+ def fetch_response(conditions = {})
65
65
  if conditions[:external_source]
66
- options = @params.merge(Api.config.merge({external_source: conditions[:external_source]}))
66
+ options = @params.merge(Api.config.merge({ external_source: conditions[:external_source] }))
67
67
  else
68
68
  options = @params.merge(Api.config)
69
69
  end
70
- response = Api.get(@resource, :query => options)
70
+ response = Api.get(@resource, query: options)
71
71
 
72
72
  original_etag = response.headers.fetch('etag', '')
73
- etag = original_etag.gsub(/"/, '')
73
+ etag = original_etag.delete('"')
74
74
 
75
- Api.set_response({'code' => response.code, 'etag' => etag})
76
- return response.to_hash
75
+ Api.set_response('code' => response.code, 'etag' => etag)
76
+ response.to_hash
77
77
  end
78
78
  end
79
79
  end
@@ -1,37 +1,36 @@
1
1
  module Tmdb
2
2
  class Season < Resource
3
- has_resource 'season', :plural => 'seasons'
3
+ has_resource 'season', plural: 'seasons'
4
4
 
5
- #Get the primary information about a TV season by its season number.
6
- def self.detail(id, season, conditions={})
7
- search = Tmdb::Search.new("/tv/#{self.endpoint_id + id.to_s}/#{self.endpoints[:singular]}/#{self.endpoint_id + season.to_s}")
5
+ # Get the primary information about a TV season by its season number.
6
+ def self.detail(id, season, conditions = {})
7
+ search = Tmdb::Search.new("/tv/#{endpoint_id + id.to_s}/#{endpoints[:singular]}/#{endpoint_id + season.to_s}")
8
8
  search.filter(conditions)
9
9
  search.fetch_response
10
10
  end
11
11
 
12
- #Get the cast credits for a TV season by season number.
13
- def self.cast(id, season, conditions={})
14
- search = Tmdb::Search.new("/tv/#{self.endpoint_id + id.to_s}/#{self.endpoints[:singular]}/#{self.endpoint_id + season.to_s}/credits")
12
+ # Get the cast credits for a TV season by season number.
13
+ def self.cast(id, season, _conditions = {})
14
+ search = Tmdb::Search.new("/tv/#{endpoint_id + id.to_s}/#{endpoints[:singular]}/#{endpoint_id + season.to_s}/credits")
15
15
  search.fetch_response['cast']
16
16
  end
17
17
 
18
- #Get the crew credits for a TV season by season number.
19
- def self.crew(id, season, conditions={})
20
- search = Tmdb::Search.new("/tv/#{self.endpoint_id + id.to_s}/#{self.endpoints[:singular]}/#{self.endpoint_id + season.to_s}/credits")
18
+ # Get the crew credits for a TV season by season number.
19
+ def self.crew(id, season, _conditions = {})
20
+ search = Tmdb::Search.new("/tv/#{endpoint_id + id.to_s}/#{endpoints[:singular]}/#{endpoint_id + season.to_s}/credits")
21
21
  search.fetch_response['crew']
22
22
  end
23
23
 
24
- #Get the external ids that we have stored for a TV season by season number.
25
- def self.external_ids(id, season, conditions={})
26
- search = Tmdb::Search.new("/tv/#{self.endpoint_id + id.to_s}/#{self.endpoints[:singular]}/#{self.endpoint_id + season.to_s}/external_ids")
24
+ # Get the external ids that we have stored for a TV season by season number.
25
+ def self.external_ids(id, season, _conditions = {})
26
+ search = Tmdb::Search.new("/tv/#{endpoint_id + id.to_s}/#{endpoints[:singular]}/#{endpoint_id + season.to_s}/external_ids")
27
27
  search.fetch_response
28
28
  end
29
29
 
30
- #Get the images (posters) that we have stored for a TV season by season number.
31
- def self.images(id, season, conditions={})
32
- search = Tmdb::Search.new("/tv/#{self.endpoint_id + id.to_s}/#{self.endpoints[:singular]}/#{self.endpoint_id + season.to_s}/images")
30
+ # Get the images (posters) that we have stored for a TV season by season number.
31
+ def self.images(id, season, _conditions = {})
32
+ search = Tmdb::Search.new("/tv/#{endpoint_id + id.to_s}/#{endpoints[:singular]}/#{endpoint_id + season.to_s}/images")
33
33
  search.fetch_response
34
34
  end
35
-
36
35
  end
37
36
  end
@@ -1,8 +1,8 @@
1
1
  module Tmdb
2
2
  class TV < Resource
3
- has_resource 'tv', :plural => 'tv'
3
+ has_resource 'tv', plural: 'tv'
4
4
 
5
- #http://docs.themoviedb.apiary.io/#tv
5
+ # http://docs.themoviedb.apiary.io/#tv
6
6
  @@fields = [
7
7
  :backdrop_path,
8
8
  :created_by,
@@ -35,48 +35,47 @@ module Tmdb
35
35
  attr_accessor field
36
36
  end
37
37
 
38
- #Get the list of popular TV shows. This list refreshes every day.
38
+ # Get the list of popular TV shows. This list refreshes every day.
39
39
  def self.popular
40
- search = Tmdb::Search.new("/tv/popular")
41
- search.fetch
40
+ search = Tmdb::Search.new('/tv/popular')
41
+ search.fetch.collect { |result| new(result) }
42
42
  end
43
43
 
44
- #Get the list of top rated TV shows. By default, this list will only include TV shows that have 2 or more votes. This list refreshes every day.
44
+ # Get the list of top rated TV shows. By default, this list will only include TV shows that have 2 or more votes. This list refreshes every day.
45
45
  def self.top_rated
46
- search = Tmdb::Search.new("/tv/top_rated")
47
- search.fetch
46
+ search = Tmdb::Search.new('/tv/top_rated')
47
+ search.fetch.collect { |result| new(result) }
48
48
  end
49
49
 
50
- #Discover TV shows by different types of data like average rating, number of votes, genres, the network they aired on and air dates
51
- def self.discover(conditions={})
52
- search = Tmdb::Search.new("/discover/tv")
50
+ # Discover TV shows by different types of data like average rating, number of votes, genres, the network they aired on and air dates
51
+ def self.discover(conditions = {})
52
+ search = Tmdb::Search.new('/discover/tv')
53
53
  search.filter(conditions)
54
- search.fetch
54
+ search.fetch.collect { |result| new(result) }
55
55
  end
56
56
 
57
- #Get the cast information about a TV series.
58
- def self.cast(id, conditions={})
59
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/credits")
57
+ # Get the cast information about a TV series.
58
+ def self.cast(id, _conditions = {})
59
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/credits")
60
60
  search.fetch_response['cast']
61
61
  end
62
62
 
63
- #Get the crew information about a TV series.
64
- def self.crew(id, conditions={})
65
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/credits")
63
+ # Get the crew information about a TV series.
64
+ def self.crew(id, _conditions = {})
65
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/credits")
66
66
  search.fetch_response['crew']
67
67
  end
68
68
 
69
- #Get the external ids that we have stored for a TV series.
70
- def self.external_ids(id, conditions={})
71
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/external_ids")
69
+ # Get the external ids that we have stored for a TV series.
70
+ def self.external_ids(id, _conditions = {})
71
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/external_ids")
72
72
  search.fetch_response
73
73
  end
74
74
 
75
- #Get the images (posters and backdrops) for a TV series.
76
- def self.images(id, conditions={})
77
- search = Tmdb::Search.new("/#{self.endpoints[:singular]}/#{self.endpoint_id + id.to_s}/images")
75
+ # Get the images (posters and backdrops) for a TV series.
76
+ def self.images(id, _conditions = {})
77
+ search = Tmdb::Search.new("/#{endpoints[:singular]}/#{endpoint_id + id.to_s}/images")
78
78
  search.fetch_response
79
79
  end
80
-
81
80
  end
82
81
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Tmdb
2
- VERSION = "0.1.0"
3
+ VERSION = '1.0.0'.freeze
3
4
  end
@@ -3,7 +3,6 @@ require 'spec_helper'
3
3
  require 'vcr'
4
4
 
5
5
  describe Tmdb::Company do
6
-
7
6
  @fields = [
8
7
  :description,
9
8
  :headquarters,
@@ -18,41 +17,39 @@ describe Tmdb::Company do
18
17
  it { should respond_to field }
19
18
  end
20
19
 
21
- describe "For a company detail" do
22
-
20
+ describe 'For a company detail' do
23
21
  before(:each) do
24
22
  VCR.use_cassette 'company/detail' do
25
23
  @company = Tmdb::Company.detail(5)
26
24
  end
27
25
  end
28
26
 
29
- it "should return a id" do
30
- @company['id'].should eq(5)
27
+ it 'should return a id' do
28
+ expect(@company['id']).to eq(5)
31
29
  end
32
30
 
33
- it "should have a description" do
34
- @company['description'].should 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.")
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.")
35
33
  end
36
34
 
37
- it "should have a homepage" do
38
- @company['homepage'].should eq("http://www.sonypictures.com/")
35
+ it 'should have a homepage' do
36
+ expect(@company['homepage']).to eq('http://www.sonypictures.com/')
39
37
  end
40
38
 
41
- it "should have logo" do
42
- @company['logo_path'].should eq("/mjUSfXXUhMiLAA1Zq1TfStNSoLR.png")
39
+ it 'should have logo' do
40
+ expect(@company['logo_path']).to eq('/mjUSfXXUhMiLAA1Zq1TfStNSoLR.png')
43
41
  end
44
42
 
45
- it "should have a name" do
46
- @company['name'].should eq("Columbia Pictures")
43
+ it 'should have a name' do
44
+ expect(@company['name']).to eq('Columbia Pictures')
47
45
  end
48
46
 
49
- it "could have a parent company" do
50
- @company['parent_company']["name"].should eq("Sony Pictures Entertainment")
47
+ it 'could have a parent company' do
48
+ expect(@company['parent_company']['name']).to eq('Sony Pictures Entertainment')
51
49
  end
52
-
53
50
  end
54
51
 
55
- describe "For a company movies" do
52
+ describe 'For a company movies' do
56
53
  before(:each) do
57
54
  VCR.use_cassette 'company/movies' do
58
55
  @movies = Tmdb::Company.movies(5)
@@ -60,38 +57,36 @@ describe Tmdb::Company do
60
57
  end
61
58
  end
62
59
 
63
- it "should give back multiple movies" do
64
- @movies.count.should > 1
60
+ it 'should give back multiple movies' do
61
+ expect(@movies.count).to be > 1
65
62
  end
66
63
 
67
- it "should have a id" do
68
- @movie["id"].should eq(97020)
64
+ it 'should have a id' do
65
+ expect(@movie.id).to eq(97_020)
69
66
  end
70
67
 
71
- it "should have a title" do
72
- @movie["title"].should eq("RoboCop")
68
+ it 'should have a title' do
69
+ expect(@movie.title).to eq('RoboCop')
73
70
  end
74
71
 
75
- it "should have a original title" do
76
- @movie["original_title"].should eq("RoboCop")
72
+ it 'should have a original title' do
73
+ expect(@movie.original_title).to eq('RoboCop')
77
74
  end
78
75
 
79
- it "should have a poster" do
80
- @movie["poster_path"].should eq("/xxLhczZMiJt1iRdhfkVkuMu87si.jpg")
76
+ it 'should have a poster' do
77
+ expect(@movie.poster_path).to eq('/xxLhczZMiJt1iRdhfkVkuMu87si.jpg')
81
78
  end
82
79
 
83
- it "should have a popularity rating" do
84
- @movie["popularity"].should eq(3.13451193740971)
80
+ it 'should have a popularity rating' do
81
+ expect(@movie.popularity).to eq(3.13451193740971)
85
82
  end
86
83
 
87
- it "should show whether it is an adult movie" do
88
- @movie["adult"].should eq(false)
84
+ it 'should show whether it is an adult movie' do
85
+ expect(@movie.adult).to eq(false)
89
86
  end
90
87
 
91
- it "should have a release date" do
92
- @movie["release_date"].should eq("2014-02-07")
88
+ it 'should have a release date' do
89
+ expect(@movie.release_date).to eq('2014-02-07')
93
90
  end
94
-
95
91
  end
96
-
97
- end
92
+ end