spec/couchrest/designs_spec.rb in couchrest_model-1.1.0.beta4 vs spec/couchrest/designs_spec.rb in couchrest_model-1.1.0.beta5
- old
+ new
@@ -85,9 +85,23 @@
@object.view('test')
end
end
+ describe "#filter" do
+
+ before :each do
+ @object = @klass.new(DesignModel)
+ end
+
+ it "should add the provided function to the design doc" do
+ @object.filter(:important, "function(doc, req) { return doc.priority == 'high'; }")
+ DesignModel.design_doc['filters'].should_not be_empty
+ DesignModel.design_doc['filters']['important'].should_not be_blank
+ end
+
+ end
+
describe "#create_view_method" do
before :each do
@object = @klass.new(DesignModel)
end