Created
December 15, 2011 20:28
-
-
Save timoxley/1482733 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'name must be unique': function(test) { | |
account.save(function(err) { | |
if (/duplicate/.test(err) || /unique/.test(err)) { | |
console.log(err.message) | |
test.done() | |
} | |
blueprints.generate('Account', function(err, anotherAccount) { | |
if (err) throw err | |
anotherAccount.name = account.name | |
anotherAccount.save(function(err) { | |
if (/duplicate/.test(err) || /unique/.test(err)) { | |
console.log(err.message) | |
test.done() | |
} | |
test.ok(err) | |
test.done() | |
}) | |
}) | |
}) | |
}, | |
'subdomain must be unique': function(test) { | |
account.save(function(err) { | |
if (/duplicate/.test(err) || /unique/.test(err)) { | |
console.log(err.message) | |
test.done() | |
} | |
blueprints.generate('Account', function(err, anotherAccount) { | |
if (err) throw err | |
anotherAccount.subdomain = account.subdomain | |
anotherAccount.save(function(err) { | |
if (/duplicate/.test(err) || /unique/.test(err)) { | |
console.log(err.message) | |
test.done() | |
} | |
test.ok(err) | |
test.done() | |
}) | |
}) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment