imdb 0.4.2 → 0.5.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.
- data/History.txt +9 -0
- data/Manifest.txt +9 -4
- data/Rakefile +1 -2
- data/lib/imdb.rb +5 -3
- data/lib/imdb/movie.rb +6 -4
- data/lib/imdb/movie_list.rb +33 -0
- data/lib/imdb/search.rb +3 -28
- data/lib/imdb/string_extensions.rb +6 -1
- data/lib/imdb/top_250.rb +10 -0
- data/spec/fixtures/top_250 +866 -0
- data/spec/fixtures/tt0111161 +1128 -0
- data/spec/{imdb_cli_spec.rb → imdb/cli_spec.rb} +2 -2
- data/spec/{imdb_movie_spec.rb → imdb/movie_spec.rb} +11 -7
- data/spec/{imdb_search_spec.rb → imdb/search_spec.rb} +1 -1
- data/spec/imdb/top_250_spec.rb +21 -0
- data/spec/spec_helper.rb +2 -0
- metadata +11 -16
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
2
|
require 'imdb/cli'
|
3
3
|
|
4
4
|
describe Imdb::CLI, "execute" do
|
@@ -31,4 +31,4 @@ describe Imdb::CLI, "execute" do
|
|
31
31
|
@stdout.should =~ /Jonathan Frakes/
|
32
32
|
end
|
33
33
|
end
|
34
|
-
end
|
34
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.dirname(__FILE__) + '
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper.rb'
|
2
2
|
|
3
3
|
# This test uses "Die hard (1988)" as a testing sample:
|
4
4
|
#
|
@@ -78,12 +78,16 @@ describe "Imdb::Movie" do
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
81
|
+
it "should provide a convenience method to search" do
|
82
|
+
movies = Imdb::Movie.search("Star Trek")
|
83
|
+
movies.should respond_to(:each)
|
84
|
+
movies.each { |movie| movie.should be_an_instance_of(Imdb::Movie) }
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should provide a convenience method to top 250" do
|
88
|
+
movies = Imdb::Movie.top_250
|
89
|
+
movies.should respond_to(:each)
|
90
|
+
movies.each { |movie| movie.should be_an_instance_of(Imdb::Movie) }
|
87
91
|
end
|
88
92
|
|
89
93
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/../spec_helper"
|
2
|
+
|
3
|
+
describe Imdb::Top250 do
|
4
|
+
before(:each) do
|
5
|
+
@movies = Imdb::Top250.new.movies
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should be a list of movies" do
|
9
|
+
@movies.each { |movie| movie.should be_an_instance_of(Imdb::Movie) }
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should return the top 250 movies from IMDB.com" do
|
13
|
+
@movies.size.should == 250
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should provide array like access to the movies" do
|
17
|
+
@first = @movies.first
|
18
|
+
@first.title.should == "The Shawshank Redemption"
|
19
|
+
@first.genres.should include("Drama")
|
20
|
+
end
|
21
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -35,6 +35,8 @@ unless ENV['LIVE_TEST']
|
|
35
35
|
"http://www.imdb.com:80/title/tt0095016/" => "tt0095016",
|
36
36
|
"http://www.imdb.com:80/title/tt0242653/" => "tt0242653",
|
37
37
|
"http://www.imdb.com:80/title/tt0242653/?fr=c2M9MXxsbT01MDB8ZmI9dXx0dD0xfG14PTIwfHFzPU1hdHJpeCBSZXZvbHV0aW9uc3xodG1sPTF8c2l0ZT1kZnxxPU1hdHJpeCBSZXZvbHV0aW9uc3xwbj0w;fc=1;ft=20" => "tt0242653",
|
38
|
+
"http://www.imdb.com:80/chart/top" => "top_250",
|
39
|
+
"http://www.imdb.com/title/tt0111161/" => "tt0111161",
|
38
40
|
}.each do |url, response|
|
39
41
|
FakeWeb.register_uri(:get, url, :response => read_fixture(response))
|
40
42
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ariejan de Vroom
|
@@ -9,19 +9,9 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-06-
|
12
|
+
date: 2009-06-17 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
16
|
-
name: httparty
|
17
|
-
type: :runtime
|
18
|
-
version_requirement:
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.4.3
|
24
|
-
version:
|
25
15
|
- !ruby/object:Gem::Dependency
|
26
16
|
name: hpricot
|
27
17
|
type: :runtime
|
@@ -72,19 +62,24 @@ files:
|
|
72
62
|
- lib/imdb.rb
|
73
63
|
- lib/imdb/cli.rb
|
74
64
|
- lib/imdb/movie.rb
|
65
|
+
- lib/imdb/movie_list.rb
|
75
66
|
- lib/imdb/search.rb
|
76
67
|
- lib/imdb/string_extensions.rb
|
68
|
+
- lib/imdb/top_250.rb
|
77
69
|
- script/console
|
78
70
|
- script/destroy
|
71
|
+
- script/generate
|
79
72
|
- spec/fixtures/search_matrix_revolutions
|
80
73
|
- spec/fixtures/search_star_trek
|
74
|
+
- spec/fixtures/top_250
|
81
75
|
- spec/fixtures/tt0095016
|
76
|
+
- spec/fixtures/tt0111161
|
82
77
|
- spec/fixtures/tt0117731
|
83
78
|
- spec/fixtures/tt0242653
|
84
|
-
-
|
85
|
-
- spec/
|
86
|
-
- spec/
|
87
|
-
- spec/
|
79
|
+
- spec/imdb/cli_spec.rb
|
80
|
+
- spec/imdb/movie_spec.rb
|
81
|
+
- spec/imdb/search_spec.rb
|
82
|
+
- spec/imdb/top_250_spec.rb
|
88
83
|
- spec/spec.opts
|
89
84
|
- spec/spec_helper.rb
|
90
85
|
- tasks/rspec.rake
|