Permalink
Browse files

gotta be exact word

  • Loading branch information...
maddox committed Nov 3, 2009
1 parent 3f6b842 commit d271bf6437369c799d0e346e4fa4304e52582cc7
Showing with 16 additions and 1 deletion.
  1. +1 −1 lib/impawards.rb
  2. +15 −0 test/impawards_test.rb
View
@@ -19,7 +19,7 @@ def self.search_posters(query)
def self.get_posters(query)
movie_urls = get_movie_results(query)
- movie_urls.delete_if{|movie_url| movie_url.inner_text !~ /#{query}/i}
+ movie_urls.delete_if{|movie_url| movie_url.inner_text !~ /^#{query} Poster -/i}
if movie_urls.size > 0
posters_for_url(movie_urls.first['href'])
else
View
@@ -93,6 +93,21 @@ class ImpawardsTest < Test::Unit::TestCase
end
end
+
+ context "with results that kinda match the query" do
+ setup do
+ @results = IMPAwards::IMPAwards.get_posters("warrior")
+ end
+
+ should "return an array" do
+ assert_equal Array, @results.class
+ end
+
+ should "return an empty array" do
+ assert @results.empty?
+ end
+
+ end
end

0 comments on commit d271bf6

Please sign in to comment.