Skip to content

Commit

Permalink
Merge pull request #2 from runa/master
Browse files Browse the repository at this point in the history
Fixed small bug on estimated_result_count
  • Loading branch information
mattetti committed Jun 17, 2013
2 parents 511b38b + 9a877da commit 6f8c13b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/ruby-web-search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,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
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 6f8c13b

Please sign in to comment.