Navigation Menu

Skip to content

Commit

Permalink
add purge view method
Browse files Browse the repository at this point in the history
  • Loading branch information
Petr Janda committed Apr 26, 2012
1 parent f18c6e8 commit c78b722
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/storage/couchStorage.js
Expand Up @@ -34,7 +34,7 @@ CouchStorage.prototype.storeView = function(view) {
}

CouchStorage.prototype.purgeView = function(id) {

this.deleteDocument(id);
}

/*
Expand Down
4 changes: 4 additions & 0 deletions lib/util/couchdb.js
Expand Up @@ -46,6 +46,10 @@ CouchDb.prototype.createDocument = function(data, callback) {
});
}

CouchDb.prototype.deleteDocument = function(id, callback) {

}

/*
* Simple function to send synchronous HTTP requests. Because we have to get
* full JSON data from couchdb before any additional processing, this method
Expand Down
10 changes: 10 additions & 0 deletions spec/storage/couchStorageSpec.js
Expand Up @@ -31,6 +31,16 @@ describe('CouchStorage', function() {
})
})

describe('.storeView', function() {
it('should call deleteDocument', function() {
spyOn(couchStorage, 'deleteDocument');

couchStorage.purgeView(1);

expect(couchStorage.deleteDocument).toHaveBeenCalledWith(1);
})
})

describe('.loadView', function() {
it('should call request', function() {
spyOn(couchStorage, 'request');
Expand Down

0 comments on commit c78b722

Please sign in to comment.