Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixed small bug on estimated_result_count #2

Merged
merged 1 commit into from

2 participants

@runa

It was returning always nil.

Thanks

@mattetti mattetti merged commit 6f8c13b into from
@mattetti
Owner

I only noticed this PR 3 years later :( I even had forgotten about this project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 31, 2010
  1. @runa
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 3 deletions.
  1. +2 −2 lib/ruby-web-search.rb
  2. +5 −1 spec/ruby-web-search_spec.rb
View
4 lib/ruby-web-search.rb
@@ -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"],
@@ -538,4 +538,4 @@ def limit(req_size)
end #of Bing
-end
+end
View
6 spec/ruby-web-search_spec.rb
@@ -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
@@ -85,4 +89,4 @@
end
end
-end
+end
Something went wrong with that request. Please try again.