Skip to content

Commit

Permalink
fix for rating parser
Browse files Browse the repository at this point in the history
  • Loading branch information
mschrag committed Jan 9, 2010
1 parent abfa5fe commit 2c90984
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/imdb/imdb.rb
Expand Up @@ -32,7 +32,7 @@ def self.find_movie_by_id(id)
movie.imdb_id = id
movie.title = coder.decode(data.at("meta[@name='title']")['content'].gsub(/\((\d{4}(\/[^)]*)?|[A-Z]+)\)/,'').strip)

rating_text = (data/"div.rating/div.meta/b").inner_text
rating_text = (data/"div.starbar-meta/b").inner_text
if rating_text =~ /([\d\.]+)\/10/
movie.rating = $1
end
Expand Down
5 changes: 3 additions & 2 deletions test/imdb_test.rb
Expand Up @@ -119,11 +119,12 @@ class ImdbTest < Test::Unit::TestCase
assert_equal 'Git (Lab Rat) (voice)', @movie.actors[14].role
end

should "have five genres" do
assert_equal 3, @movie.genres.length
should "have four genres" do
assert_equal 4, @movie.genres.length
assert_equal 'Animation', @movie.genres[0].name
assert_equal 'Comedy', @movie.genres[1].name
assert_equal 'Family', @movie.genres[2].name
assert_equal 'Fantasy', @movie.genres[3].name
end

should "have a tagline" do
Expand Down

0 comments on commit 2c90984

Please sign in to comment.