spotlite 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -0
- data/README.md +6 -2
- data/lib/spotlite.rb +3 -0
- data/lib/spotlite/list.rb +12 -0
- data/lib/spotlite/movie.rb +22 -35
- data/lib/spotlite/search.rb +40 -0
- data/lib/spotlite/string_extensions.rb +24 -0
- data/lib/spotlite/version.rb +1 -1
- data/spec/fixtures/search_the_core +817 -0
- data/spec/fixtures/tt0002186/index +195 -190
- data/spec/fixtures/tt0047396/releaseinfo +52 -51
- data/spec/fixtures/tt0133093/fullcredits +47 -39
- data/spec/fixtures/tt0133093/index +449 -577
- data/spec/fixtures/tt0133093/keywords +46 -38
- data/spec/fixtures/tt0133093/releaseinfo +48 -40
- data/spec/fixtures/tt0133093/trivia +204 -181
- data/spec/fixtures/tt0169547/index +472 -595
- data/spec/fixtures/tt0317248/index +505 -642
- data/spec/spec_helper.rb +2 -1
- data/spec/spotlite/search_spec.rb +29 -0
- data/tasks/fixtures.rake +1 -1
- metadata +9 -2
data/spec/spec_helper.rb
CHANGED
@@ -19,7 +19,8 @@ IMDB_SAMPLES = {
|
|
19
19
|
"http://www.imdb.com/title/tt0317248/" => "tt0317248/index",
|
20
20
|
"http://www.imdb.com/title/tt0169547/" => "tt0169547/index",
|
21
21
|
"http://www.imdb.com/title/tt0047396/releaseinfo" => "tt0047396/releaseinfo",
|
22
|
-
"http://www.imdb.com/title/tt0002186/" => "tt0002186/index"
|
22
|
+
"http://www.imdb.com/title/tt0002186/" => "tt0002186/index",
|
23
|
+
"http://www.imdb.com/find?q=the+core&s=all" => "search_the_core"
|
23
24
|
}
|
24
25
|
|
25
26
|
unless ENV['LIVE_TEST']
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Spotlite::Search" do
|
4
|
+
before(:each) do
|
5
|
+
@search = Spotlite::Search.new("the core")
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should return 7 results" do
|
9
|
+
@search.movies.size.should eql(7)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should return Spotlite::Movie objects" do
|
13
|
+
@search.movies.each { |movie| movie.should be_a(Spotlite::Movie) }
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should return IMDb ID, title, and year" do
|
17
|
+
@search.movies.first.imdb_id.should eql("0298814")
|
18
|
+
@search.movies.first.title.should eql("The Core")
|
19
|
+
@search.movies.first.year.should eql(2003)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should not contain video games" do
|
23
|
+
@search.movies.each { |movie| movie.imdb_id.should_not eql("0483593") }
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should not contain TV series/episodes" do
|
27
|
+
@search.movies.each { |movie| movie.imdb_id.should_not eql("1979599") }
|
28
|
+
end
|
29
|
+
end
|
data/tasks/fixtures.rake
CHANGED
@@ -4,7 +4,7 @@ namespace :fixtures do
|
|
4
4
|
require File.expand_path(File.dirname(__FILE__) + "/../spec/spec_helper")
|
5
5
|
|
6
6
|
IMDB_SAMPLES.each_pair do |url, fixture|
|
7
|
-
page = `curl -
|
7
|
+
page = `curl -isH "Accept-Language: en-us" #{url}`
|
8
8
|
|
9
9
|
File.open(File.expand_path(File.dirname(__FILE__) + "/../spec/fixtures/#{fixture}"), 'w') do |f|
|
10
10
|
f.write(page)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spotlite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -75,8 +75,12 @@ files:
|
|
75
75
|
- README.md
|
76
76
|
- Rakefile
|
77
77
|
- lib/spotlite.rb
|
78
|
+
- lib/spotlite/list.rb
|
78
79
|
- lib/spotlite/movie.rb
|
80
|
+
- lib/spotlite/search.rb
|
81
|
+
- lib/spotlite/string_extensions.rb
|
79
82
|
- lib/spotlite/version.rb
|
83
|
+
- spec/fixtures/search_the_core
|
80
84
|
- spec/fixtures/tt0002186/index
|
81
85
|
- spec/fixtures/tt0047396/releaseinfo
|
82
86
|
- spec/fixtures/tt0133093/fullcredits
|
@@ -88,6 +92,7 @@ files:
|
|
88
92
|
- spec/fixtures/tt0317248/index
|
89
93
|
- spec/spec_helper.rb
|
90
94
|
- spec/spotlite/movie_spec.rb
|
95
|
+
- spec/spotlite/search_spec.rb
|
91
96
|
- spotlite.gemspec
|
92
97
|
- tasks/fixtures.rake
|
93
98
|
homepage: http://github.com/defeed/spotlite
|
@@ -115,6 +120,7 @@ signing_key:
|
|
115
120
|
specification_version: 3
|
116
121
|
summary: Ruby gem to fetch publicly available information about movies from IMDb
|
117
122
|
test_files:
|
123
|
+
- spec/fixtures/search_the_core
|
118
124
|
- spec/fixtures/tt0002186/index
|
119
125
|
- spec/fixtures/tt0047396/releaseinfo
|
120
126
|
- spec/fixtures/tt0133093/fullcredits
|
@@ -126,3 +132,4 @@ test_files:
|
|
126
132
|
- spec/fixtures/tt0317248/index
|
127
133
|
- spec/spec_helper.rb
|
128
134
|
- spec/spotlite/movie_spec.rb
|
135
|
+
- spec/spotlite/search_spec.rb
|