Sha256: 5d67120804214f7cefb76aa76a33e72d8b3f9540d754798c9f3b1e5f721a96cd
Contents?: true
Size: 1.41 KB
Versions: 2
Compression:
Stored size: 1.41 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') class Article < CouchRest::Model::Base use_database DB end describe "CouchrestModelSearch" do before :each do if doc = Article.stored_design_doc doc.database = Article.database doc.destroy end end it "should overwrite default_design_doc" do Article.design_doc["fulltext"].should_not be_nil end end describe "overwrite design doc" do class CustomArticle < CouchRest::Model::Base use_database DB search_by :fulltext, {:index => %(function(doc) {})} end before :each do if doc = CustomArticle.stored_design_doc doc.database = CustomArticle.database doc.destroy end end it "should allow class to overwrite fulltext function" do CustomArticle.update_search_doc CustomArticle.stored_design_doc["fulltext"]["by_fulltext"]["index"].should == %(function(doc) {}) end it "should update search doc" do CustomArticle.update_search_doc CustomArticle.stored_design_doc["fulltext"]["by_fulltext"]["index"].should == %(function(doc) {}) class CustomArticle < CouchRest::Model::Base use_database DB search_by :fulltext, {:index => %(function(doc) {// hello})} end CustomArticle.update_search_doc CustomArticle.stored_design_doc["fulltext"]["by_fulltext"]["index"].should == %(function(doc) {// hello}) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
couchrest_model_search-0.0.4 | spec/couchrest_model_search_spec.rb |
couchrest_model_search-0.0.3 | spec/couchrest_model_search_spec.rb |