Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed small bug on estimated_result_count #2

Merged
merged 1 commit into from
Jun 17, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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