porras-imdb 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README +11 -4
- data/lib/imdb/imdb_movie.rb +8 -0
- data/spec/imdb_movie_spec.rb +8 -0
- data/spec/imdb_search_spec.rb +17 -0
- metadata +1 -1
data/README
CHANGED
@@ -16,10 +16,12 @@ ImdbMovie Indiana Jones and the Last Crusade
|
|
16
16
|
- should get the color
|
17
17
|
- should get the company
|
18
18
|
- should get some photos
|
19
|
+
- should get the tagline
|
20
|
+
- should get the aspect ratio
|
19
21
|
|
20
|
-
ImdbMovie Indiana Jones and the Last Crusade title pre-caching
|
22
|
+
ImdbMovie Indiana Jones and the Last Crusade title pre-caching & get_data
|
21
23
|
- should have the original title before querying anything
|
22
|
-
- should have the updated title after
|
24
|
+
- should have the updated title after calling get_data
|
23
25
|
|
24
26
|
ImdbMovie Han robado una estrella
|
25
27
|
- should query IMDB url
|
@@ -48,6 +50,11 @@ ImdbSearch Indiana Jones movies
|
|
48
50
|
- should have titles
|
49
51
|
- should not have titles with HTML tags
|
50
52
|
|
53
|
+
ImdbSearch Torrent
|
54
|
+
|
55
|
+
ImdbSearch Torrent movies
|
56
|
+
- should include 'Misión en Marbella (2001)'
|
57
|
+
|
51
58
|
String
|
52
59
|
|
53
60
|
String unescape_html
|
@@ -57,6 +64,6 @@ String unescape_html
|
|
57
64
|
String strip_tags
|
58
65
|
- should strip HTML tags
|
59
66
|
|
60
|
-
Finished in 2.
|
67
|
+
Finished in 2.787784 seconds
|
61
68
|
|
62
|
-
|
69
|
+
41 examples, 0 failures
|
data/lib/imdb/imdb_movie.rb
CHANGED
@@ -39,6 +39,14 @@ class ImdbMovie
|
|
39
39
|
document.search("//h5[text()^='Plot']/..").innerHTML.split("\n")[2].gsub(/<.+>.+<\/.+>/, '').strip.unescape_html rescue nil
|
40
40
|
end
|
41
41
|
|
42
|
+
def tagline
|
43
|
+
document.search("//h5[text()^='Tagline']/..").innerHTML.split("\n")[2].gsub(/<.+>.+<\/.+>/, '').strip.unescape_html rescue nil
|
44
|
+
end
|
45
|
+
|
46
|
+
def aspect_ratio
|
47
|
+
document.search("//h5[text()^='Aspect Ratio']/..").innerHTML.split("\n")[2].gsub(/<.+>.+<\/.+>/, '').strip.unescape_html rescue nil
|
48
|
+
end
|
49
|
+
|
42
50
|
def length
|
43
51
|
document.search("//h5[text()^='Runtime']/..").innerHTML[/\d+ min/] rescue nil
|
44
52
|
end
|
data/spec/imdb_movie_spec.rb
CHANGED
@@ -82,6 +82,14 @@ describe ImdbMovie do
|
|
82
82
|
@imdb_movie.photos.should include('http://ia.media-imdb.com/images/M/MV5BMjAwNTM4ODc3Nl5BMl5BanBnXkFtZTYwNzU0OTE3._V1._CR82,0,320,320_SS90_.jpg')
|
83
83
|
end
|
84
84
|
|
85
|
+
it "should get the tagline" do
|
86
|
+
@imdb_movie.tagline.should == "He's back in an all new adventure. Memorial Day 1989."
|
87
|
+
end
|
88
|
+
|
89
|
+
it "should get the aspect ratio" do
|
90
|
+
@imdb_movie.aspect_ratio.should == "2.20 : 1"
|
91
|
+
end
|
92
|
+
|
85
93
|
describe "title pre-caching & get_data" do
|
86
94
|
|
87
95
|
it "should have the original title before querying anything" do
|
data/spec/imdb_search_spec.rb
CHANGED
@@ -43,5 +43,22 @@ describe ImdbSearch do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
end
|
46
|
+
|
47
|
+
describe 'Torrent' do
|
48
|
+
|
49
|
+
before(:each) do
|
50
|
+
@imdb_search = ImdbSearch.new('torrente')
|
51
|
+
@imdb_search.stub!(:open).and_return(open("#{$samples_dir}/sample_spanish_search.html"))
|
52
|
+
end
|
53
|
+
|
54
|
+
describe "movies" do
|
55
|
+
|
56
|
+
it "should include 'Misión en Marbella (2001)'" do
|
57
|
+
@imdb_search.movies.map { |m| m.title }.should include('Misión en Marbella (2001)')
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
46
63
|
|
47
64
|
end
|