summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Christopher Anderson <jchris@apache.org>2009-07-20 04:11:36 +0000
committerJohn Christopher Anderson <jchris@apache.org>2009-07-20 04:11:36 +0000
commit46bf4b727f0fae37b017f194983122c50d3f34e5 (patch)
tree658da02543e8f53388d6ea427afa3e6265d5254d /test
parentc3175ec3b2809a553cd0f45bfa39ca573676f842 (diff)
Initial checkin of _changes filters. The prime weak-spot for this approach is that it maintains an OS-process per connected filtered _changes consumer. I'm pretty sure we'll be able to work around this without changing the API, but it'll involve a lot of OS-process bookkeeping. Those enhancements should generally improve show & list performance as well. Punting on them for now, first wanted to get _changes filters implemented so people could give feedback.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@795687 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
-rw-r--r--test/query_server_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/query_server_spec.rb b/test/query_server_spec.rb
index ffa2635b..dfc57a5b 100644
--- a/test/query_server_spec.rb
+++ b/test/query_server_spec.rb
@@ -239,6 +239,15 @@ functions = {
return "tail";
};
JS
+ },
+ "filter-basic" => {
+ "js" => <<-JS
+ function(doc, req, userCtx) {
+ if (doc.good) {
+ return true;
+ }
+ }
+ JS
}
}
@@ -420,6 +429,18 @@ describe "query server normal case" do
should == true
end
end
+
+ describe "changes filter" do
+ before(:all) do
+ @fun = functions["filter-basic"][LANGUAGE]
+ @qs.reset!
+ @qs.add_fun(@fun).should == true
+ end
+ it "should only return true for good docs" do
+ @qs.run(["filter", [{"key"=>"bam", "good" => true}, {"foo" => "bar"}, {"good" => true}]]).
+ should == [true, [true, false, true]]
+ end
+ end
end
def should_have_exited qs