Skip to content

Commit

Permalink
bugfixed estimated_result_count returning always nil
Browse files Browse the repository at this point in the history
  • Loading branch information
runa committed Oct 31, 2010
1 parent d093af6 commit 9a877da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/ruby-web-search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def process(google_raw_response={})
@results ||= []
@status = google_raw_response["responseStatus"]
if google_raw_response["responseData"] && status && status == 200
estimated_result_count ||= google_raw_response["cursor"]["estimatedResultCount"] if google_raw_response["cursor"]
@estimated_result_count ||= google_raw_response['responseData']["cursor"]["estimatedResultCount"] if google_raw_response['responseData']["cursor"]
@results += google_raw_response["responseData"]["results"].map do |r|
{
:title => r["titleNoFormatting"],
Expand Down Expand Up @@ -538,4 +538,4 @@ def limit(req_size)

end #of Bing

end
end
6 changes: 5 additions & 1 deletion spec/ruby-web-search_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
@response.results.size.should == 4
end

it "should have a non nil estimated_result_count" do
@response.estimated_result_count.should_not == nil
end

describe "results" do
before(:all) do
@results = @response.results
Expand Down Expand Up @@ -85,4 +89,4 @@
end
end

end
end

0 comments on commit 9a877da

Please sign in to comment.