spotlite 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -27,6 +27,9 @@ IMDB_SAMPLES = {
27
27
  "http://www.imdb.com/chart/top" => "top",
28
28
  "http://www.imdb.com/movies-in-theaters/" => "movies_in_theaters",
29
29
  "http://www.imdb.com/movies-coming-soon/" => "movies_coming_soon",
30
+ "http://www.imdb.com/name/nm0005132/" => "nm0005132/index",
31
+ "http://www.imdb.com/name/nm1659547/" => "nm1659547/index",
32
+ "http://www.imdb.com/name/nm0864666/" => "nm0864666/index"
30
33
  }
31
34
 
32
35
  unless ENV['LIVE_TEST']
@@ -45,6 +45,22 @@ describe "Spotlite::Movie" do
45
45
  @movie.description.should match(/A computer hacker learns from mysterious rebels about the true nature of his reality and his role in the war against its controllers./)
46
46
  end
47
47
 
48
+ it "should return storyline" do
49
+ @movie.storyline.should match(/Thomas A. Anderson is a man living two lives. By day he is an average computer programmer and by night a hacker known as Neo. Neo has always questioned his reality, but the truth is far beyond his imagination. Neo finds himself targeted by the police when he is contacted by Morpheus, a legendary computer hacker branded a terrorist by the government. Morpheus awakens Neo to the real world, a ravaged wasteland where most of humanity have been captured by a race of machines that live off of the humans' body heat and electrochemical energy and who imprison their minds within an artificial reality known as the Matrix. As a rebel against the machines, Neo must return to the Matrix and confront the agents: super-powerful computer programs devoted to snuffing out Neo and the entire human rebellion./)
50
+ end
51
+
52
+ describe "content rating" do
53
+ it "should return MPAA content rating if it's given" do
54
+ @movie.content_rating.should eql("R")
55
+ end
56
+
57
+ it "should return nil if it's missing" do
58
+ # Rear Window (1954)
59
+ @movie = Spotlite::Movie.new("0047396")
60
+ @movie.content_rating.should be_nil
61
+ end
62
+ end
63
+
48
64
  it "should return genres" do
49
65
  @movie.genres.should be_an(Array)
50
66
  @movie.genres.size.should eql(3)
@@ -159,11 +175,11 @@ describe "Spotlite::Movie" do
159
175
  # Rear Window (1954)
160
176
  @movie = Spotlite::Movie.new("0047396")
161
177
  @movie.release_dates.should be_an(Array)
162
- @movie.release_dates.size.should eql(43)
163
- @movie.release_dates.should include({:code => "jp", :region => "Japan", :date => Date.new(1955,1,14)})
164
- @movie.release_dates.should include({:code => "tr", :region => "Turkey", :date => Date.new(1956,4,1)})
165
- @movie.release_dates.should include({:code => "us", :region => "USA", :date => Date.new(1968,1,1)})
166
- @movie.release_dates.detect{ |r| r[:region] == "France" }.should eql({:code => "fr", :region => "France", :date => Date.new(1955,4,1)})
178
+ @movie.release_dates.size.should be_within(10).of(50)
179
+ @movie.release_dates.should include({:code => "us", :region => "USA", :date => Date.new(1954,8,1), :comment => "premiere, New York City, New York"})
180
+ @movie.release_dates.should include({:code => "jp", :region => "Japan", :date => Date.new(1955,1,14), :comment => nil})
181
+ @movie.release_dates.should include({:code => "tr", :region => "Turkey", :date => Date.new(1956,4,1), :comment => nil})
182
+ @movie.release_dates.detect{ |r| r[:region] == "France" }.should eql({:code => "fr", :region => "France", :date => Date.new(1955,4,1), :comment => nil})
167
183
  end
168
184
 
169
185
  it "should return original release date" do
@@ -0,0 +1,49 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Spotlite::Person" do
4
+
5
+ describe "valid person" do
6
+
7
+ before(:each) do
8
+ # Heath Ledger
9
+ @person = Spotlite::Person.new("0005132")
10
+ end
11
+
12
+ it "should return name" do
13
+ @person.name.should eql("Heath Ledger")
14
+ end
15
+
16
+ it "should return born name if present" do
17
+ @person.birth_name.should eql("Heath Andrew Ledger")
18
+ end
19
+
20
+ it "should return birth date" do
21
+ @person.birth_date.should be_a(Date)
22
+ @person.birth_date.should eql(Date.new(1979,4,4))
23
+ end
24
+
25
+ it "should return death date if present" do
26
+ @person.death_date.should be_a(Date)
27
+ @person.death_date.should eql(Date.new(2008,1,22))
28
+ end
29
+
30
+ describe "photo URL" do
31
+ it "should return old style photo URL" do
32
+ @person.photo_url.should eql("http://ia.media-imdb.com/images/M/MV5BMTI2NTY0NzA4MF5BMl5BanBnXkFtZTYwMjE1MDE0.jpg")
33
+ end
34
+
35
+ it "should return new style photo URL" do
36
+ # Carey Mulligan
37
+ @person = Spotlite::Person.new("1659547")
38
+ @person.photo_url.should eql("http://ia.media-imdb.com/images/M/MV5BMTQ2MTQyMzYzMV5BMl5BanBnXkFtZTcwODY0ODI4Mg@@.jpg")
39
+ end
40
+
41
+ it "should return nil if photo doesn't exist" do
42
+ # Natalie Tjern
43
+ @person = Spotlite::Person.new("0864666")
44
+ @person.photo_url.should be_nil
45
+ end
46
+ end
47
+ end
48
+
49
+ end
@@ -6,7 +6,7 @@ describe "Spotlite::Search" do
6
6
  end
7
7
 
8
8
  it "should return 6 results" do
9
- @search.movies.size.should eql(6)
9
+ @search.movies.size.should be_within(5).of(10)
10
10
  end
11
11
 
12
12
  it "should return Spotlite::Movie objects" do
metadata CHANGED
@@ -1,18 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spotlite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Artem Pakk
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-05-03 00:00:00.000000000 Z
12
+ date: 2013-06-19 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: nokogiri
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ~>
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ~>
25
28
  - !ruby/object:Gem::Version
@@ -27,6 +30,7 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: rspec
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - ~>
32
36
  - !ruby/object:Gem::Version
@@ -34,6 +38,7 @@ dependencies:
34
38
  type: :development
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - ~>
39
44
  - !ruby/object:Gem::Version
@@ -41,15 +46,17 @@ dependencies:
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: fakeweb
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
- - - '>='
51
+ - - ! '>='
46
52
  - !ruby/object:Gem::Version
47
53
  version: '0'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
- - - '>='
59
+ - - ! '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  description: Spotlite gem helps you fetch all kinds of publicly available information
@@ -74,12 +81,16 @@ files:
74
81
  - lib/spotlite/list.rb
75
82
  - lib/spotlite/movie.rb
76
83
  - lib/spotlite/opening_this_week.rb
84
+ - lib/spotlite/person.rb
77
85
  - lib/spotlite/search.rb
78
86
  - lib/spotlite/string_extensions.rb
79
87
  - lib/spotlite/top.rb
80
88
  - lib/spotlite/version.rb
81
89
  - spec/fixtures/movies_coming_soon
82
90
  - spec/fixtures/movies_in_theaters
91
+ - spec/fixtures/nm0005132/index
92
+ - spec/fixtures/nm0864666/index
93
+ - spec/fixtures/nm1659547/index
83
94
  - spec/fixtures/search_no_results
84
95
  - spec/fixtures/search_the_core
85
96
  - spec/fixtures/top
@@ -99,36 +110,41 @@ files:
99
110
  - spec/spotlite/coming_soon_spec.rb
100
111
  - spec/spotlite/movie_spec.rb
101
112
  - spec/spotlite/opening_this_week_spec.rb
113
+ - spec/spotlite/person_spec.rb
102
114
  - spec/spotlite/search_spec.rb
103
115
  - spec/spotlite/top_spec.rb
104
116
  - spotlite.gemspec
105
117
  - tasks/fixtures.rake
106
118
  homepage: http://github.com/defeed/spotlite
107
119
  licenses: []
108
- metadata: {}
109
120
  post_install_message:
110
121
  rdoc_options: []
111
122
  require_paths:
112
123
  - lib
113
124
  required_ruby_version: !ruby/object:Gem::Requirement
125
+ none: false
114
126
  requirements:
115
- - - '>='
127
+ - - ! '>='
116
128
  - !ruby/object:Gem::Version
117
129
  version: '0'
118
130
  required_rubygems_version: !ruby/object:Gem::Requirement
131
+ none: false
119
132
  requirements:
120
- - - '>='
133
+ - - ! '>='
121
134
  - !ruby/object:Gem::Version
122
135
  version: '0'
123
136
  requirements: []
124
137
  rubyforge_project:
125
- rubygems_version: 2.0.0
138
+ rubygems_version: 1.8.25
126
139
  signing_key:
127
- specification_version: 4
140
+ specification_version: 3
128
141
  summary: Ruby gem to fetch publicly available information about movies from IMDb
129
142
  test_files:
130
143
  - spec/fixtures/movies_coming_soon
131
144
  - spec/fixtures/movies_in_theaters
145
+ - spec/fixtures/nm0005132/index
146
+ - spec/fixtures/nm0864666/index
147
+ - spec/fixtures/nm1659547/index
132
148
  - spec/fixtures/search_no_results
133
149
  - spec/fixtures/search_the_core
134
150
  - spec/fixtures/top
@@ -148,5 +164,6 @@ test_files:
148
164
  - spec/spotlite/coming_soon_spec.rb
149
165
  - spec/spotlite/movie_spec.rb
150
166
  - spec/spotlite/opening_this_week_spec.rb
167
+ - spec/spotlite/person_spec.rb
151
168
  - spec/spotlite/search_spec.rb
152
169
  - spec/spotlite/top_spec.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 7ffc5276a23a935fb934f851e517bd0367e691c2
4
- data.tar.gz: b54037672fd1c08d647e0f92b70a66667a601514
5
- SHA512:
6
- metadata.gz: 85f417c3e7772a180263d74f83caf3ca8119deedb7205f5ddb4ef5fa7d1bea32fec6210b197673260f7fb17f1b3e85e4ee97dbcf15f17cab357bdf13138d9225
7
- data.tar.gz: ebfe14e313c7df100e0ccbe12e5ee518c88e2b45f6a2eb0d4f6c20daf080018599a960e30f897f8bf832c96d2d7459728c32c879d28c2e808215611d8dba4af8