Permalink
Browse files

Fixed a typo a method call, adding missing hash instantiation back, c…

…hanged instance var for hash back to local var.
  • Loading branch information...
1 parent 07899fb commit 983e5b9f11456bfa50658b68de520abae6e5a843 @djensen47 djensen47 committed May 18, 2012
Showing with 16 additions and 9 deletions.
  1. +10 −9 lib/aws_cloud_search/search_request.rb
  2. +6 −0 spec/aws_cloud_search/search_request_spec.rb
View
19 lib/aws_cloud_search/search_request.rb
@@ -43,15 +43,16 @@ def add_t(field, t_from, t_to)
# Returns the hash of all the values for this SearchRequest. Useful for creating URL params.
# @return [Hash] The object converted to a Hash
def to_hash
- @hash['q'] = @q unless @q.nil?
- @hash['bq'] = @bq unless @bq.nil?
- @hash['rank'] = @rank unless @rank.nil?
- @hash['size'] = @size unless @size.nil?
- @hash['start'] = @start unless @start.nil?
- @hash['results-type'] = @results_type unless @results_type.nil?
- @hash['return-fields'] = @return_fields.join(',') unless @return_fields.nil?
- @hash['facet'] = @facet unless @facet.nill?
- @hash.merge(@facet_constraints).merge(@facet_sort).merge(@facet_top_n).merge(@t)
+ hash = {}
+ hash['q'] = @q unless @q.nil?
+ hash['bq'] = @bq unless @bq.nil?
+ hash['rank'] = @rank unless @rank.nil?
+ hash['size'] = @size unless @size.nil?
+ hash['start'] = @start unless @start.nil?
+ hash['results-type'] = @results_type unless @results_type.nil?
+ hash['return-fields'] = @return_fields.join(',') unless @return_fields.nil?
+ hash['facet'] = @facet unless @facet.nil?
+ hash.merge(@facet_constraints).merge(@facet_sort).merge(@facet_top_n).merge(@t)
end
end
View
6 spec/aws_cloud_search/search_request_spec.rb
@@ -21,4 +21,10 @@
end
end
+ context "#to_hash" do
+ it "should return an empty hash" do
+ search_req.to_hash.should eq({})
+ end
+ end
+
end

0 comments on commit 983e5b9

Please sign in to comment.