Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Tree: fb311d0b51
Fetching contributors…

Cannot retrieve contributors at this time

45 lines (37 sloc) 1.088 kB
Mongorito = require '../lib/mongorito'
Mongorito.connect 'mongorito', ['']
Mongorito.cache ['']
require 'should'
class Post
constructor: ->
super 'posts'
Post = Mongorito.bake Post
describe 'Mongorito', ->
describe 'creating new record', ->
it 'should create new record in "posts" collection', (done) ->
post = new Post
post.title = 'Very nice post!' = 'Vadim' ->
Post.find (err, posts) ->
posts.length.should.equal 1
do done
describe 'editing record', ->
it 'should save edited version of the post', (done) ->
Post.find (err, posts) ->
post = posts[0]
post.title = 'Edited title!' ->
do done
describe 'getting record', ->
it 'should fetch just edited post', (done) ->
Post.find (err, posts) ->
posts[0].title.should.equal 'Edited title!'
do done
describe 'deleting record', ->
it 'should remove post', (done) ->
Post.find (err, posts) ->
posts[0].remove ->
Post.find (err, posts) ->
posts.length.should.equal 0
do done
Jump to Line
Something went wrong with that request. Please try again.