spotlite 0.3.0 → 0.4.0

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.
@@ -11,18 +11,21 @@ def read_fixture(path)
11
11
  end
12
12
 
13
13
  IMDB_SAMPLES = {
14
- "http://www.imdb.com/title/tt0133093/" => "tt0133093/index",
15
- "http://www.imdb.com/title/tt0133093/fullcredits" => "tt0133093/fullcredits",
16
- "http://www.imdb.com/title/tt0133093/keywords" => "tt0133093/keywords",
17
- "http://www.imdb.com/title/tt0133093/releaseinfo" => "tt0133093/releaseinfo",
18
- "http://www.imdb.com/title/tt0133093/trivia" => "tt0133093/trivia",
19
- "http://www.imdb.com/title/tt0317248/" => "tt0317248/index",
20
- "http://www.imdb.com/title/tt0169547/" => "tt0169547/index",
21
- "http://www.imdb.com/title/tt0047396/releaseinfo" => "tt0047396/releaseinfo",
22
- "http://www.imdb.com/title/tt0002186/" => "tt0002186/index",
23
- "http://www.imdb.com/title/tt1134629/fullcredits" => "tt1134629/fullcredits",
24
- "http://www.imdb.com/find?q=the+core&s=all" => "search_the_core",
25
- "http://www.imdb.com/chart/top" => "top"
14
+ "http://www.imdb.com/title/tt0133093/" => "tt0133093/index",
15
+ "http://www.imdb.com/title/tt0133093/fullcredits" => "tt0133093/fullcredits",
16
+ "http://www.imdb.com/title/tt0133093/keywords" => "tt0133093/keywords",
17
+ "http://www.imdb.com/title/tt0133093/releaseinfo" => "tt0133093/releaseinfo",
18
+ "http://www.imdb.com/title/tt0133093/trivia" => "tt0133093/trivia",
19
+ "http://www.imdb.com/title/tt0133093/criticreviews" => "tt0133093/criticreviews",
20
+ "http://www.imdb.com/title/tt0317248/" => "tt0317248/index",
21
+ "http://www.imdb.com/title/tt0169547/" => "tt0169547/index",
22
+ "http://www.imdb.com/title/tt0047396/releaseinfo" => "tt0047396/releaseinfo",
23
+ "http://www.imdb.com/title/tt0002186/" => "tt0002186/index",
24
+ "http://www.imdb.com/title/tt1134629/fullcredits" => "tt1134629/fullcredits",
25
+ "http://www.imdb.com/find?q=the+core&s=all" => "search_the_core",
26
+ "http://www.imdb.com/find?q=wappadoozle+swambling&s=all" => "search_no_results",
27
+ "http://www.imdb.com/chart/top" => "top",
28
+ "http://www.imdb.com/movies-in-theaters/" => "movies_in_theaters"
26
29
  }
27
30
 
28
31
  unless ENV['LIVE_TEST']
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Spotlite::BoxOfficeTop" do
4
+ before(:each) do
5
+ @list = Spotlite::BoxOfficeTop.new.movies
6
+ end
7
+
8
+ it "should return 10 results" do
9
+ @list.size.should eql(10)
10
+ end
11
+
12
+ it "should return Spotlite::Movie objects" do
13
+ @list.each { |movie| movie.should be_a(Spotlite::Movie) }
14
+ end
15
+
16
+ describe "Movie" do
17
+ it "should have IMDb ID" do
18
+ @list.each { |movie| movie.imdb_id.should match(/\d{7}/) }
19
+ end
20
+
21
+ it "should have title" do
22
+ @list.each { |movie| movie.title.should match(/\w+/) }
23
+ end
24
+
25
+ it "should have year" do
26
+ @list.each { |movie| movie.year.to_s.should match(/\d{4}/) }
27
+ end
28
+ end
29
+ end
@@ -37,6 +37,10 @@ describe "Spotlite::Movie" do
37
37
  @movie.votes.should be_within(50000).of(700000)
38
38
  end
39
39
 
40
+ it "should return Metascore rating" do
41
+ @movie.metascore.should eql(73)
42
+ end
43
+
40
44
  it "should return description" do
41
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./)
42
46
  end
@@ -150,15 +154,51 @@ describe "Spotlite::Movie" do
150
154
  @movie.stars.should include({:imdb_id => "0005251", :name => "Carrie-Anne Moss"})
151
155
  end
152
156
 
153
- it "should return release dates" do
154
- # Rear Window (1954)
155
- @movie = Spotlite::Movie.new("0047396")
156
- @movie.release_dates.should be_an(Array)
157
- @movie.release_dates.size.should eql(43)
158
- @movie.release_dates.should include({:code => "jp", :region => "Japan", :date => Date.new(1955,1,14)})
159
- @movie.release_dates.should include({:code => "tr", :region => "Turkey", :date => Date.new(1956,4,1)})
160
- @movie.release_dates.should include({:code => "us", :region => "USA", :date => Date.new(1968,1,1)})
161
- @movie.release_dates.detect{ |r| r[:region] == "France" }.should eql({:code => "fr", :region => "France", :date => Date.new(1955,4,1)})
157
+ describe "release dates" do
158
+ it "should return release dates" do
159
+ # Rear Window (1954)
160
+ @movie = Spotlite::Movie.new("0047396")
161
+ @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)})
167
+ end
168
+
169
+ it "should return original release date" do
170
+ @movie.release_date.should eql(Date.new(1999,3,31))
171
+ end
172
+ end
173
+
174
+ it "should return critic reviews" do
175
+ @movie.critic_reviews.should be_an(Array)
176
+ @movie.critic_reviews.size.should eql(11)
177
+ @movie.critic_reviews.should include(
178
+ {
179
+ :source => "Chicago Sun-Times",
180
+ :author => "Roger Ebert",
181
+ :excerpt => "A visually dazzling cyberadventure, full of kinetic excitement, but it retreats to formula just when it's getting interesting.",
182
+ :score => 75
183
+ }
184
+ )
185
+ @movie.critic_reviews.should include(
186
+ {
187
+ :source => "Chicago Tribune",
188
+ :author => "",
189
+ :excerpt => "The writing remains more intelligent than most thrillers, and the action is executed with such panache that even if you don't buy the reality of The Matrix, it's a helluva place to visit.",
190
+ :score => 75
191
+ }
192
+ )
193
+
194
+ @movie.critic_reviews.should include(
195
+ {
196
+ :source => "Los Angeles Times",
197
+ :author => "Kenneth Turan",
198
+ :excerpt => "A wildly cinematic futuristic thriller that is determined to overpower the imagination, The Matrix combines traditional science-fiction premises with spanking new visual technology in a way that almost defies description.",
199
+ :score => 90
200
+ }
201
+ )
162
202
  end
163
203
 
164
204
  end
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Spotlite::OpeningThisWeek" do
4
+ before(:each) do
5
+ @list = Spotlite::OpeningThisWeek.new.movies
6
+ end
7
+
8
+ it "should return a few results" do
9
+ @list.size.should be_within(14).of(15)
10
+ end
11
+
12
+ it "should return Spotlite::Movie objects" do
13
+ @list.each { |movie| movie.should be_a(Spotlite::Movie) }
14
+ end
15
+
16
+ describe "Movie" do
17
+ it "should have IMDb ID" do
18
+ @list.each { |movie| movie.imdb_id.should match(/\d{7}/) }
19
+ end
20
+
21
+ it "should have title" do
22
+ @list.each { |movie| movie.title.should match(/\w+/) }
23
+ end
24
+
25
+ it "should have year" do
26
+ @list.each { |movie| movie.year.to_s.should match(/\d{4}/) }
27
+ end
28
+ end
29
+ end
@@ -5,8 +5,8 @@ describe "Spotlite::Search" do
5
5
  @search = Spotlite::Search.new("the core")
6
6
  end
7
7
 
8
- it "should return 7 results" do
9
- @search.movies.size.should eql(7)
8
+ it "should return 6 results" do
9
+ @search.movies.size.should eql(6)
10
10
  end
11
11
 
12
12
  it "should return Spotlite::Movie objects" do
@@ -26,4 +26,9 @@ describe "Spotlite::Search" do
26
26
  it "should not contain TV series/episodes" do
27
27
  @search.movies.each { |movie| movie.imdb_id.should_not eql("1979599") }
28
28
  end
29
+
30
+ it "should handle 'No results found'" do
31
+ @search = Spotlite::Search.new("wappadoozle swambling")
32
+ @search.movies.should be_empty
33
+ end
29
34
  end
@@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
16
16
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
17
17
  gem.require_paths = ["lib"]
18
18
 
19
- gem.add_dependency "nokogiri", "~> 1.5.6"
20
- gem.add_development_dependency "rspec", "~> 2.12.0"
19
+ gem.add_dependency "nokogiri", "~> 1.5"
20
+ gem.add_development_dependency "rspec", "~> 2.13"
21
21
  gem.add_development_dependency "fakeweb"
22
22
  end
metadata CHANGED
@@ -1,52 +1,46 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spotlite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
5
- prerelease:
4
+ version: 0.4.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Artem Pakk
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-28 00:00:00.000000000 Z
11
+ date: 2013-05-03 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: nokogiri
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
- version: 1.5.6
19
+ version: '1.5'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
29
- version: 1.5.6
26
+ version: '1.5'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rspec
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
37
- version: 2.12.0
33
+ version: '2.13'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
45
- version: 2.12.0
40
+ version: '2.13'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: fakeweb
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ! '>='
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ! '>='
60
53
  - !ruby/object:Gem::Version
@@ -75,16 +68,22 @@ files:
75
68
  - README.md
76
69
  - Rakefile
77
70
  - lib/spotlite.rb
71
+ - lib/spotlite/box_office_top.rb
72
+ - lib/spotlite/in_theaters.rb
78
73
  - lib/spotlite/list.rb
79
74
  - lib/spotlite/movie.rb
75
+ - lib/spotlite/opening_this_week.rb
80
76
  - lib/spotlite/search.rb
81
77
  - lib/spotlite/string_extensions.rb
82
78
  - lib/spotlite/top.rb
83
79
  - lib/spotlite/version.rb
80
+ - spec/fixtures/movies_in_theaters
81
+ - spec/fixtures/search_no_results
84
82
  - spec/fixtures/search_the_core
85
83
  - spec/fixtures/top
86
84
  - spec/fixtures/tt0002186/index
87
85
  - spec/fixtures/tt0047396/releaseinfo
86
+ - spec/fixtures/tt0133093/criticreviews
88
87
  - spec/fixtures/tt0133093/fullcredits
89
88
  - spec/fixtures/tt0133093/index
90
89
  - spec/fixtures/tt0133093/keywords
@@ -94,40 +93,44 @@ files:
94
93
  - spec/fixtures/tt0317248/index
95
94
  - spec/fixtures/tt1134629/fullcredits
96
95
  - spec/spec_helper.rb
96
+ - spec/spotlite/box_office_top_spec.rb
97
97
  - spec/spotlite/movie_spec.rb
98
+ - spec/spotlite/opening_this_week_spec.rb
98
99
  - spec/spotlite/search_spec.rb
99
100
  - spec/spotlite/top_spec.rb
100
101
  - spotlite.gemspec
101
102
  - tasks/fixtures.rake
102
103
  homepage: http://github.com/defeed/spotlite
103
104
  licenses: []
105
+ metadata: {}
104
106
  post_install_message:
105
107
  rdoc_options: []
106
108
  require_paths:
107
109
  - lib
108
110
  required_ruby_version: !ruby/object:Gem::Requirement
109
- none: false
110
111
  requirements:
111
112
  - - ! '>='
112
113
  - !ruby/object:Gem::Version
113
114
  version: '0'
114
115
  required_rubygems_version: !ruby/object:Gem::Requirement
115
- none: false
116
116
  requirements:
117
117
  - - ! '>='
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0'
120
120
  requirements: []
121
121
  rubyforge_project:
122
- rubygems_version: 1.8.25
122
+ rubygems_version: 2.0.3
123
123
  signing_key:
124
- specification_version: 3
124
+ specification_version: 4
125
125
  summary: Ruby gem to fetch publicly available information about movies from IMDb
126
126
  test_files:
127
+ - spec/fixtures/movies_in_theaters
128
+ - spec/fixtures/search_no_results
127
129
  - spec/fixtures/search_the_core
128
130
  - spec/fixtures/top
129
131
  - spec/fixtures/tt0002186/index
130
132
  - spec/fixtures/tt0047396/releaseinfo
133
+ - spec/fixtures/tt0133093/criticreviews
131
134
  - spec/fixtures/tt0133093/fullcredits
132
135
  - spec/fixtures/tt0133093/index
133
136
  - spec/fixtures/tt0133093/keywords
@@ -137,6 +140,8 @@ test_files:
137
140
  - spec/fixtures/tt0317248/index
138
141
  - spec/fixtures/tt1134629/fullcredits
139
142
  - spec/spec_helper.rb
143
+ - spec/spotlite/box_office_top_spec.rb
140
144
  - spec/spotlite/movie_spec.rb
145
+ - spec/spotlite/opening_this_week_spec.rb
141
146
  - spec/spotlite/search_spec.rb
142
147
  - spec/spotlite/top_spec.rb