Skip to content
Browse files

set default store

  • Loading branch information...
1 parent 8896d38 commit b0e670bb14e9aa121f28618db34b85c319773752 @lancejpollard lancejpollard committed
View
14 Makefile
@@ -1,10 +1,16 @@
-SRC = $(shell find test -name "*Test.coffee")
+SRC = $(shell find test -name "*associationCursorTest.coffee")
STORES = memory mongodb
+CMD = ./node_modules/mocha/bin/mocha
test-all:
for i in $(STORES); do ./node_modules/mocha/bin/mocha $(SRC) --store $$i; done
-test:
- ./node_modules/mocha/bin/mocha $(SRC) --store memory
+test: test-memory
-.PHONY: test test-all
+test-memory:
+ $(CMD) $(SRC) --store memory
+
+test-mongodb:
+ $(CMD) $(SRC) --store mongodb
+
+.PHONY: test-memory test-mongodb test test-all
View
2 src/tower/model/persistence.coffee
@@ -25,7 +25,7 @@ Tower.Model.Persistence =
store = metadata.store
return store if arguments.length == 0 && store
- defaultStore = @default('store') || Tower.Store.Memory
+ defaultStore = @default('store') || Tower.Model.default('store') || Tower.Store.Memory
type = typeof value
View
2 src/tower/server/application.coffee
@@ -164,7 +164,7 @@ class Tower.Application extends Tower.Engine
store = require "./store/#{databaseName}"
if !defaultStoreSet || databaseConfig.default
- Tower.Model.default('store', store)
+ Tower.Model.default('store', store) unless Tower.Model.default('store')
defaultStoreSet = true
#Tower.callback 'initialize', name: "#{store.className()}.initialize", (done) ->
View
434 test/cases/model/relation/associationCursorTest.coffee
@@ -43,272 +43,260 @@ class App.AssociationCursorAddress extends Tower.Model
@validates 'city', 'state', presence: true
-describeWith = (store) ->
- describe "Tower.Model.Relation (association cursor, Tower.Store.#{store.className()})", ->
- record = null
- cursor = null
- association = null
- key = null
-
- beforeEach (done) ->
- store.clean =>
- App.AssociationCursorTest.store(store)
- App.AssociationCursorAddress.store(store)
- App.AssociationCursorUser.store(store)
- App.AssociationCursorPost.store(store)
- done()
-
- describe 'new owner', ->
- describe 'hasMany', ->
- beforeEach ->
- record = App.AssociationCursorTest.build()
- cursor = record.getAssociationCursor('associationCursorPosts')
- association = record.constructor.relations()['associationCursorPosts']
-
- test 'getAssociation', ->
- assert.isTrue record.getAssociationScope('associationCursorPosts') instanceof Tower.Model.Scope, "record.getAssociationScope('associationCursorPosts') instanceof Tower.Model.Scope"
- assert.isTrue record.getAssociationScope('associationCursorPosts').cursor.isHasMany, 'cursor.isHasMany'
- assert.isTrue record.getAssociationCursor('associationCursorPosts').isHasMany, 'getAssociationCursor("associationCursorPosts").isHasMany'
-
- test 'setHasManyAssociation', ->
- assert.equal cursor.length, 0
- # pass single item
- record._setHasManyAssociation('associationCursorPosts', App.AssociationCursorPost.build(), association)
- assert.equal cursor.length, 1
- # pass single item in array
- record._setHasManyAssociation('associationCursorPosts', [App.AssociationCursorPost.build()], association)
- assert.equal cursor.length, 1
- # pass multiple items in array
- record._setHasManyAssociation('associationCursorPosts', [App.AssociationCursorPost.build(), App.AssociationCursorPost.build()], association)
- assert.equal cursor.length, 2
-
- test '_associatedRecordsToValidateOrSave(cursor, isNew: true, autosave: false)', ->
- assert.equal record._associatedRecordsToValidateOrSave(cursor, true).length, 0
- record._setHasManyAssociation('associationCursorPosts', App.AssociationCursorPost.build(), association)
- assert.equal record._associatedRecordsToValidateOrSave(cursor, true).length, 1
-
- test '_associatedRecordsToValidateOrSave(cursor, isNew: false, autosave: true) should return records where record._changedForAutosave() is true', ->
- newRecord = App.AssociationCursorPost.build()
- existingRecord = App.AssociationCursorPost.build()
- existingRecord.setProperties(isNew: false, isDirty: false, id: 10)
-
- record._setHasManyAssociation('associationCursorPosts', [newRecord, existingRecord], association)
-
- assert.equal record._associatedRecordsToValidateOrSave(cursor, false, true).length, 1
-
- test '_associatedRecordsToValidateOrSave(cursor, isNew: false, autosave: false) should return new records', ->
- newRecord = App.AssociationCursorPost.build()
- existingRecord = App.AssociationCursorPost.build()
- existingRecord.setProperties(isNew: false)
-
- record._setHasManyAssociation('associationCursorPosts', [newRecord, existingRecord], association)
-
- assert.equal record._associatedRecordsToValidateOrSave(cursor, false, false).length, 1
-
- test '_validateCollectionAssociation', ->
- record._setHasManyAssociation('associationCursorPosts', [App.AssociationCursorPost.build()], association)
- assert.isFalse record._validateCollectionAssociation(association), 'record._validateCollectionAssociation(association)'
-
- # @todo what should the error message be?
- assert.deepEqual record.get('errors'), {associationCursorPosts: ['Invalid']}
-
- record.set('errors', {}) # don't know how to clear the errors in this case yet
-
- record._setHasManyAssociation('associationCursorPosts', App.AssociationCursorPost.build(title: 'A Title!'), association)
- assert.isTrue record._validateCollectionAssociation(association), 'record._validateCollectionAssociation(association)'
-
- test 'set', ->
- record.set('associationCursorPosts', App.AssociationCursorPost.build(title: 'A Title!'))
- assert.isTrue record._validateCollectionAssociation(association), 'record._validateCollectionAssociation(association)'
-
-
- test '_saveCollectionAssociation', (done) ->
- record.save =>
- child = App.AssociationCursorPost.build(title: 'A Title!')
- record.set('associationCursorPosts', child)
-
- record._saveCollectionAssociation association, =>
- assert.equal child.get('associationCursorTest').get('id').toString(), record.get('id').toString()
- done()
-
- test 'save', (done) ->
- child = App.AssociationCursorPost.build(title: 'A Title!')
- record.set('associationCursorPosts', child)
-
- record.save =>
- assert.ok record.get('id')
- assert.equal child.get('associationCursorTestId').toString(), record.get('id').toString()
- done()
-
- test 'replace', (done) ->
- child1 = App.AssociationCursorPost.build(title: 'First Title!')
-
- record.updateAttributes associationCursorPosts: [child1], =>
- firstId = child1.get('associationCursorTestId').toString()
- assert.ok firstId
- child2 = App.AssociationCursorPost.build(title: 'Second Title!')
-
- record.updateAttributes associationCursorPosts: [child2], =>
- secondId = child2.get('associationCursorTestId')
- assert.ok secondId
- assert.equal firstId.toString(), secondId.toString()
- # @todo
- assert.isUndefined child1.get('associationCursorTestId')
- assert.equal child2.get('associationCursorTestId').toString(), record.get('id').toString()
-
- record.get('associationCursorPosts').all (error, count) =>
- assert.equal count.length, 1
- done()
-
- test 'nullify', (done) ->
- child1 = App.AssociationCursorPost.build(title: 'First Title!')
-
- record.updateAttributes associationCursorPosts: [child1], =>
- record.updateAttributes associationCursorPosts: [], =>
- assert.isUndefined child1.get('associationCursorTestId')
-
- record.get('associationCursorPosts').all (error, count) =>
- assert.equal count.length, 0
- done()
-
- describe 'belongsTo', ->
+describe "Tower.Model.Relation (association cursor", ->
+ record = null
+ cursor = null
+ association = null
+ key = null
+
+ describe 'new owner', ->
+ describe 'hasMany', ->
beforeEach ->
record = App.AssociationCursorTest.build()
- cursor = record.getAssociationCursor('associationCursorUser')
- association = record.constructor.relations()['associationCursorUser']
+ cursor = record.getAssociationCursor('associationCursorPosts')
+ association = record.constructor.relations()['associationCursorPosts']
- afterEach ->
- #association.autosave = undefined
-
test 'getAssociation', ->
- assert.isTrue record.getAssociationScope('associationCursorUser') instanceof Tower.Model.Scope, "record.getAssociationScope('associationCursorUser') instanceof Tower.Model.Scope"
- assert.isTrue record.getAssociationScope('associationCursorUser').cursor.isBelongsTo, 'cursor.isBelongsTo'
- assert.isTrue record.getAssociationCursor('associationCursorUser').isBelongsTo, 'getAssociationCursor("associationCursorUser").isBelongsTo'
-
- test 'setBelongsToAssociation', ->
+ assert.isTrue record.getAssociationScope('associationCursorPosts') instanceof Tower.Model.Scope, "record.getAssociationScope('associationCursorPosts') instanceof Tower.Model.Scope"
+ assert.isTrue record.getAssociationScope('associationCursorPosts').cursor.isHasMany, 'cursor.isHasMany'
+ assert.isTrue record.getAssociationCursor('associationCursorPosts').isHasMany, 'getAssociationCursor("associationCursorPosts").isHasMany'
+
+ test 'setHasManyAssociation', ->
assert.equal cursor.length, 0
# pass single item
- record._setBelongsToAssociation('associationCursorUser', App.AssociationCursorUser.build(), association)
+ record._setHasManyAssociation('associationCursorPosts', App.AssociationCursorPost.build(), association)
+ assert.equal cursor.length, 1
+ # pass single item in array
+ record._setHasManyAssociation('associationCursorPosts', [App.AssociationCursorPost.build()], association)
assert.equal cursor.length, 1
+ # pass multiple items in array
+ record._setHasManyAssociation('associationCursorPosts', [App.AssociationCursorPost.build(), App.AssociationCursorPost.build()], association)
+ assert.equal cursor.length, 2
+
+ test '_associatedRecordsToValidateOrSave(cursor, isNew: true, autosave: false)', ->
+ assert.equal record._associatedRecordsToValidateOrSave(cursor, true).length, 0
+ record._setHasManyAssociation('associationCursorPosts', App.AssociationCursorPost.build(), association)
+ assert.equal record._associatedRecordsToValidateOrSave(cursor, true).length, 1
+
+ test '_associatedRecordsToValidateOrSave(cursor, isNew: false, autosave: true) should return records where record._changedForAutosave() is true', ->
+ newRecord = App.AssociationCursorPost.build()
+ existingRecord = App.AssociationCursorPost.build()
+ existingRecord.setProperties(isNew: false, isDirty: false, id: 10)
+
+ record._setHasManyAssociation('associationCursorPosts', [newRecord, existingRecord], association)
- test '_validateSingleAssociation', ->
- record._setBelongsToAssociation('associationCursorUser', App.AssociationCursorUser.build(), association)
- assert.isFalse record._validateSingleAssociation(association), 'record._validateSingleAssociation(association)'
+ assert.equal record._associatedRecordsToValidateOrSave(cursor, false, true).length, 1
- assert.deepEqual record.get('errors'), {associationCursorUser: ['Invalid']}
+ test '_associatedRecordsToValidateOrSave(cursor, isNew: false, autosave: false) should return new records', ->
+ newRecord = App.AssociationCursorPost.build()
+ existingRecord = App.AssociationCursorPost.build()
+ existingRecord.setProperties(isNew: false)
+
+ record._setHasManyAssociation('associationCursorPosts', [newRecord, existingRecord], association)
+
+ assert.equal record._associatedRecordsToValidateOrSave(cursor, false, false).length, 1
+
+ test '_validateCollectionAssociation', ->
+ record._setHasManyAssociation('associationCursorPosts', [App.AssociationCursorPost.build()], association)
+ assert.isFalse record._validateCollectionAssociation(association), 'record._validateCollectionAssociation(association)'
+
+ # @todo what should the error message be?
+ assert.deepEqual record.get('errors'), {associationCursorPosts: ['Invalid']}
record.set('errors', {}) # don't know how to clear the errors in this case yet
- record._setBelongsToAssociation('associationCursorUser', App.AssociationCursorUser.build(username: 'fred'), association)
- assert.isTrue record._validateSingleAssociation(association), 'record._validateSingleAssociation(association)'
+ record._setHasManyAssociation('associationCursorPosts', App.AssociationCursorPost.build(title: 'A Title!'), association)
+ assert.isTrue record._validateCollectionAssociation(association), 'record._validateCollectionAssociation(association)'
test 'set', ->
- record.set('associationCursorUser', App.AssociationCursorUser.build(username: 'fred'))
- assert.isTrue record._validateSingleAssociation(association), 'record._validateSingleAssociation(association)'
+ record.set('associationCursorPosts', App.AssociationCursorPost.build(title: 'A Title!'))
+ assert.isTrue record._validateCollectionAssociation(association), 'record._validateCollectionAssociation(association)'
- test '_saveBelongsToAssociation', (done) ->
- record.set('associationCursorUser', App.AssociationCursorUser.build(username: 'fred'))
-
- record._saveBelongsToAssociation association, =>
- assert.ok record.get('associationCursorUser').get('id')
- done()
+
+ test '_saveCollectionAssociation', (done) ->
+ record.save =>
+ child = App.AssociationCursorPost.build(title: 'A Title!')
+ record.set('associationCursorPosts', child)
+ record._saveCollectionAssociation association, =>
+ assert.equal child.get('associationCursorTest').get('id').toString(), record.get('id').toString()
+ done()
+
test 'save', (done) ->
- record.set('associationCursorUser', App.AssociationCursorUser.build(username: 'john'))
+ child = App.AssociationCursorPost.build(title: 'A Title!')
+ record.set('associationCursorPosts', child)
record.save =>
assert.ok record.get('id')
- assert.equal record.get('associationCursorUser').get('id').toString(), record.get('associationCursorUserId').toString()
+ assert.equal child.get('associationCursorTestId').toString(), record.get('id').toString()
done()
test 'replace', (done) ->
- record.updateAttributes associationCursorUser: App.AssociationCursorUser.build(username: 'john'), =>
- firstId = record.get('associationCursorUserId')
+ child1 = App.AssociationCursorPost.build(title: 'First Title!')
+
+ record.updateAttributes associationCursorPosts: [child1], =>
+ firstId = child1.get('associationCursorTestId').toString()
assert.ok firstId
- record.updateAttributes associationCursorUser: App.AssociationCursorUser.build(username: 'john'), =>
- secondId = record.get('associationCursorUserId')
+ child2 = App.AssociationCursorPost.build(title: 'Second Title!')
+
+ record.updateAttributes associationCursorPosts: [child2], =>
+ secondId = child2.get('associationCursorTestId')
assert.ok secondId
- assert.notEqual firstId.toString(), secondId.toString()
- done()
+ assert.equal firstId.toString(), secondId.toString()
+ # @todo
+ assert.isUndefined child1.get('associationCursorTestId')
+ assert.equal child2.get('associationCursorTestId').toString(), record.get('id').toString()
- test 'nullify', (done) ->
- record.updateAttributes associationCursorUser: App.AssociationCursorUser.build(username: 'john'), =>
- record.updateAttributes associationCursorUser: null, =>
- assert.isUndefined record.get('associationCursorUserId')
- done()
+ record.get('associationCursorPosts').all (error, count) =>
+ assert.equal count.length, 1
+ done()
- describe 'hasOne', ->
- beforeEach ->
- record = App.AssociationCursorTest.build()
- key = 'associationCursorAddress'
- cursor = record.getAssociationCursor(key)
- association = record.constructor.relations()[key]
-
- test 'getAssociation', ->
- assert.isTrue record.getAssociationScope(key) instanceof Tower.Model.Scope, "record.getAssociationScope(key) instanceof Tower.Model.Scope"
- assert.isTrue record.getAssociationScope(key).cursor.isHasOne, 'cursor.isHasOne'
- assert.isTrue record.getAssociationCursor(key).isHasOne, 'getAssociationCursor("associationCursorUser").isHasOne'
-
- test 'setHasOneAssociation', ->
- assert.equal cursor.length, 0
- # pass single item
- record._setHasOneAssociation(key, App.AssociationCursorAddress.build(), association)
- assert.equal cursor.length, 1
+ test 'nullify', (done) ->
+ child1 = App.AssociationCursorPost.build(title: 'First Title!')
+
+ record.updateAttributes associationCursorPosts: [child1], =>
+ record.updateAttributes associationCursorPosts: [], =>
+ assert.isUndefined child1.get('associationCursorTestId')
+
+ record.get('associationCursorPosts').all (error, count) =>
+ assert.equal count.length, 0
+ done()
- test '_validateSingleAssociation', ->
- record._setHasOneAssociation(key, App.AssociationCursorAddress.build(), association)
- assert.isFalse record._validateSingleAssociation(association), 'record._validateSingleAssociation(association)'
+ describe 'belongsTo', ->
+ beforeEach ->
+ record = App.AssociationCursorTest.build()
+ cursor = record.getAssociationCursor('associationCursorUser')
+ association = record.constructor.relations()['associationCursorUser']
+
+ afterEach ->
+ #association.autosave = undefined
+
+ test 'getAssociation', ->
+ assert.isTrue record.getAssociationScope('associationCursorUser') instanceof Tower.Model.Scope, "record.getAssociationScope('associationCursorUser') instanceof Tower.Model.Scope"
+ assert.isTrue record.getAssociationScope('associationCursorUser').cursor.isBelongsTo, 'cursor.isBelongsTo'
+ assert.isTrue record.getAssociationCursor('associationCursorUser').isBelongsTo, 'getAssociationCursor("associationCursorUser").isBelongsTo'
+
+ test 'setBelongsToAssociation', ->
+ assert.equal cursor.length, 0
+ # pass single item
+ record._setBelongsToAssociation('associationCursorUser', App.AssociationCursorUser.build(), association)
+ assert.equal cursor.length, 1
+
+ test '_validateSingleAssociation', ->
+ record._setBelongsToAssociation('associationCursorUser', App.AssociationCursorUser.build(), association)
+ assert.isFalse record._validateSingleAssociation(association), 'record._validateSingleAssociation(association)'
+
+ assert.deepEqual record.get('errors'), {associationCursorUser: ['Invalid']}
+
+ record.set('errors', {}) # don't know how to clear the errors in this case yet
+
+ record._setBelongsToAssociation('associationCursorUser', App.AssociationCursorUser.build(username: 'fred'), association)
+ assert.isTrue record._validateSingleAssociation(association), 'record._validateSingleAssociation(association)'
+
+ test 'set', ->
+ record.set('associationCursorUser', App.AssociationCursorUser.build(username: 'fred'))
+ assert.isTrue record._validateSingleAssociation(association), 'record._validateSingleAssociation(association)'
+
+ test '_saveBelongsToAssociation', (done) ->
+ record.set('associationCursorUser', App.AssociationCursorUser.build(username: 'fred'))
+
+ record._saveBelongsToAssociation association, =>
+ assert.ok record.get('associationCursorUser').get('id')
+ done()
- assert.deepEqual record.get('errors'), {associationCursorAddress: ['Invalid']}
+ test 'save', (done) ->
+ record.set('associationCursorUser', App.AssociationCursorUser.build(username: 'john'))
- record.set('errors', {}) # don't know how to clear the errors in this case yet
+ record.save =>
+ assert.ok record.get('id')
+ assert.equal record.get('associationCursorUser').get('id').toString(), record.get('associationCursorUserId').toString()
+ done()
- record._setHasOneAssociation(key, App.AssociationCursorAddress.build(city: 'San Francisco', state: 'CA'), association)
- assert.isTrue record._validateSingleAssociation(association), 'record._validateSingleAssociation(association)'
-
- test 'set', ->
- record.set(key, App.AssociationCursorAddress.build(city: 'San Francisco', state: 'CA'))
- assert.isTrue record._validateSingleAssociation(association), 'record._validateSingleAssociation(association)'
+ test 'replace', (done) ->
+ record.updateAttributes associationCursorUser: App.AssociationCursorUser.build(username: 'john'), =>
+ firstId = record.get('associationCursorUserId')
+ assert.ok firstId
+ record.updateAttributes associationCursorUser: App.AssociationCursorUser.build(username: 'john'), =>
+ secondId = record.get('associationCursorUserId')
+ assert.ok secondId
+ assert.notEqual firstId.toString(), secondId.toString()
+ done()
- test '_saveHasOneAssociation', (done) ->
- record.save =>
- child = App.AssociationCursorAddress.build(city: 'San Francisco', state: 'CA')
- record.set(key, child)
+ test 'nullify', (done) ->
+ record.updateAttributes associationCursorUser: App.AssociationCursorUser.build(username: 'john'), =>
+ record.updateAttributes associationCursorUser: null, =>
+ assert.isUndefined record.get('associationCursorUserId')
+ done()
- record._saveHasOneAssociation association, =>
- assert.equal child.get('associationCursorTestId').toString(), record.get('id').toString()
- done()
-
- test 'save', (done) ->
+ describe 'hasOne', ->
+ beforeEach ->
+ record = App.AssociationCursorTest.build()
+ key = 'associationCursorAddress'
+ cursor = record.getAssociationCursor(key)
+ association = record.constructor.relations()[key]
+
+ test 'getAssociation', ->
+ assert.isTrue record.getAssociationScope(key) instanceof Tower.Model.Scope, "record.getAssociationScope(key) instanceof Tower.Model.Scope"
+ assert.isTrue record.getAssociationScope(key).cursor.isHasOne, 'cursor.isHasOne'
+ assert.isTrue record.getAssociationCursor(key).isHasOne, 'getAssociationCursor("associationCursorUser").isHasOne'
+
+ test 'setHasOneAssociation', ->
+ assert.equal cursor.length, 0
+ # pass single item
+ record._setHasOneAssociation(key, App.AssociationCursorAddress.build(), association)
+ assert.equal cursor.length, 1
+
+ test '_validateSingleAssociation', ->
+ record._setHasOneAssociation(key, App.AssociationCursorAddress.build(), association)
+ assert.isFalse record._validateSingleAssociation(association), 'record._validateSingleAssociation(association)'
+
+ assert.deepEqual record.get('errors'), {associationCursorAddress: ['Invalid']}
+
+ record.set('errors', {}) # don't know how to clear the errors in this case yet
+
+ record._setHasOneAssociation(key, App.AssociationCursorAddress.build(city: 'San Francisco', state: 'CA'), association)
+ assert.isTrue record._validateSingleAssociation(association), 'record._validateSingleAssociation(association)'
+
+ test 'set', ->
+ record.set(key, App.AssociationCursorAddress.build(city: 'San Francisco', state: 'CA'))
+ assert.isTrue record._validateSingleAssociation(association), 'record._validateSingleAssociation(association)'
+
+ test '_saveHasOneAssociation', (done) ->
+ record.save =>
child = App.AssociationCursorAddress.build(city: 'San Francisco', state: 'CA')
record.set(key, child)
- record.save =>
- assert.ok record.get('id')
+ record._saveHasOneAssociation association, =>
assert.equal child.get('associationCursorTestId').toString(), record.get('id').toString()
done()
+
+ test 'save', (done) ->
+ child = App.AssociationCursorAddress.build(city: 'San Francisco', state: 'CA')
+ record.set(key, child)
+
+ record.save =>
+ assert.ok record.get('id')
+ assert.equal child.get('associationCursorTestId').toString(), record.get('id').toString()
+ done()
- test 'setting multiple times when parent is persistent', (done) ->
- record.save =>
- App.AssociationCursorAddress.create city: 'San Francisco', state: 'CA', (error, child1) =>
- child2 = App.AssociationCursorAddress.build(city: 'San Francisco', state: 'CA')
- record.set(key, child1)
- record.set(key, child2)
-
- assert.isUndefined record.getAssociationCursor(key)._markedForDestruction
-
- done()
-
- test 'setting multiple times when parent is persistent and relationship already existed', (done) ->
- child1 = App.AssociationCursorAddress.build city: 'San Francisco', state: 'CA'
- record.updateAttributes associationCursorAddress: child1, =>
+ test 'setting multiple times when parent is persistent', (done) ->
+ record.save =>
+ App.AssociationCursorAddress.create city: 'San Francisco', state: 'CA', (error, child1) =>
child2 = App.AssociationCursorAddress.build(city: 'San Francisco', state: 'CA')
record.set(key, child1)
record.set(key, child2)
- assert.equal record.getAssociationCursor(key)._markedForDestruction, child1
+ assert.isUndefined record.getAssociationCursor(key)._markedForDestruction
done()
-describeWith(Tower.Store.Memory)
-describeWith(Tower.Store.Mongodb) unless Tower.client
+ test 'setting multiple times when parent is persistent and relationship already existed', (done) ->
+ child1 = App.AssociationCursorAddress.build city: 'San Francisco', state: 'CA'
+ record.updateAttributes associationCursorAddress: child1, =>
+ child2 = App.AssociationCursorAddress.build(city: 'San Francisco', state: 'CA')
+ record.set(key, child1)
+ record.set(key, child2)
+
+ assert.equal record.getAssociationCursor(key)._markedForDestruction, child1
+
+ done()
View
8 test/server.coffee
@@ -30,7 +30,10 @@ app = Tower.Application.instance()
Tower.Net.Connection.reopen(notify: ->)
before (done) ->
- app.initialize done
+ Tower.Model.default('store', Tower.store)
+
+ app.initialize =>
+ done()
# App.Address.store().collection().ensureIndex {coordinates:"2d"}, done
beforeEach (done) ->
@@ -42,8 +45,7 @@ beforeEach (done) ->
Tower.View.store().loadPaths = ["test/example/app/views"]
Tower.Application.instance().initialize ->
- Tower.store.clean =>
- Tower.Store.Mongodb.clean(done)
+ Tower.store.clean(done)
after (done) ->
return done()

0 comments on commit b0e670b

Please sign in to comment.
Something went wrong with that request. Please try again.