Browse files

more tests

  • Loading branch information...
1 parent 0b34fc7 commit 491c432348a1913e145f0a87aa05ebdc65d721de @tj committed Apr 22, 2011
Showing with 26 additions and 0 deletions.
  1. +26 −0 test/test.migrate.js
View
26 test/test.migrate.js
@@ -97,11 +97,37 @@ function testNewMigrations() {
assertPets.withDogs();
set.down(function(){
assertNoPets();
+ testMigrationEvents();
});
});
});
}
+// test events
+
+function testMigrationEvents() {
+ migrate('adjust emails', function(next){
+ db.pets.forEach(function(pet){
+ if (pet.email)
+ pet.email = pet.email.replace('learnboost.com', 'lb.com');
+ });
+ next();
+ }, function(next){
+ db.pets.forEach(function(pet){
+ if (pet.email)
+ pet.email = pet.email.replace('lb.com', 'learnboost.com');
+ });
+ next();
+ });
+
+ set.up(function(){
+ db.pets[0].email.should.equal('tobi@lb.com');
+ set.down(function(){
+ assertNoPets();
+ });
+ });
+}
+
// helpers
function assertNoPets() {

0 comments on commit 491c432

Please sign in to comment.