Sha256: a3041a6dd2e39cc59486c001d39cacae8e463b6bd7ca0288a8bd1e4470b3980d
Contents?: true
Size: 1.46 KB
Versions: 3
Compression:
Stored size: 1.46 KB
Contents
require File.dirname(__FILE__) + '/spec_helper' describe "automatic view updates" do before(:each) do recreate_db @db = CouchPotato.couchrest_database end it "should update a view that doesn't match the given functions" do CouchPotato::View::ViewQuery.new(@db, 'test_design1', 'test_view', 'function(doc) {}', 'function() {}').query_view! # create view CouchPotato::View::ViewQuery.new(@db, 'test_design1', 'test_view', 'function(doc) {emit(doc.id, null)}', 'function(key, values) {return sum(values)}').query_view! CouchPotato.database.load('_design/test_design1')['views']['test_view'].should == { 'map' => 'function(doc) {emit(doc.id, null)}', 'reduce' => 'function(key, values) {return sum(values)}' } end it "should only update a view once to avoid writing the view for every request" do CouchPotato::View::ViewQuery.new(@db, 'test_design2', 'test_view', 'function(doc) {}', 'function() {}').query_view! # create view CouchPotato::View::ViewQuery.new(@db, 'test_design2', 'test_view', 'function(doc) {emit(doc.id, null)}', 'function(key, values) {return sum(values)}').query_view! CouchPotato::View::ViewQuery.new(@db, 'test_design2', 'test_view', 'function(doc) {}', 'function() {}').query_view! CouchPotato.database.load('_design/test_design2')['views']['test_view'].should == { 'map' => 'function(doc) {emit(doc.id, null)}', 'reduce' => 'function(key, values) {return sum(values)}' } end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
couch_potato-0.2.27 | spec/view_updates_spec.rb |
couch_potato-0.2.26 | spec/view_updates_spec.rb |
couch_potato-0.2.25 | spec/view_updates_spec.rb |