diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/query_server_spec.rb | 21 |
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 |