summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/query_server_spec.rb24
1 files changed, 23 insertions, 1 deletions
diff --git a/test/query_server_spec.rb b/test/query_server_spec.rb
index dfc57a5b..c9fb6942 100644
--- a/test/query_server_spec.rb
+++ b/test/query_server_spec.rb
@@ -242,12 +242,21 @@ functions = {
},
"filter-basic" => {
"js" => <<-JS
- function(doc, req, userCtx) {
+ function(doc, req) {
if (doc.good) {
return true;
}
}
JS
+ },
+ "update-basic" => {
+ "js" => <<-JS
+ function(doc, req) {
+ doc.world = "hello";
+ var resp = [doc, "hello doc"];
+ return resp;
+ }
+ JS
}
}
@@ -441,6 +450,19 @@ describe "query server normal case" do
should == [true, [true, false, true]]
end
end
+
+ describe "update" do
+ before(:all) do
+ @fun = functions["update-basic"][LANGUAGE]
+ @qs.reset!
+ end
+ it "should return a doc and a resp body" do
+ up, doc, resp = @qs.run(["update", @fun, {"foo" => "gnarly"}, {"verb" => "POST"}])
+ up.should == "up"
+ doc.should == {"foo" => "gnarly", "world" => "hello"}
+ resp["body"].should == "hello doc"
+ end
+ end
end
def should_have_exited qs