Skip to content

Commit

Permalink
Adding test for the :out => {:db …} key
Browse files Browse the repository at this point in the history
Forgot to add the test in the last commit.
  • Loading branch information
johnewart committed Dec 15, 2011
1 parent 28796ac commit 6c0b372
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/collection_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,19 @@ def test_map_reduce_with_collection_merge
@@test.map_reduce(m, r, :raw => true, :out => {:inline => 1})
assert res["results"]
end

def test_map_reduce_with_collection_output_to_other_db
@@test << {:user_id => 1}
@@test << {:user_id => 2}

m = Code.new("function() { emit(this.user_id, 1); }")
r = Code.new("function(k,vals) { return 1; }")
res = @@test.map_reduce(m, r, :out => {:replace => 'foo', :db => 'somedb'})
assert res["result"]
assert res["counts"]
assert res["timeMillis"]
assert res.find.to_a.any? {|doc| doc["_id"] == 2 && doc["value"] == 1}
end
end
end

Expand Down

0 comments on commit 6c0b372

Please sign in to comment.