Skip to content

Commit

Permalink
added verifyAll to Jocha obj method and sort of tested it
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/jyurek/Backups/repositories/jocha/trunk@14 5317845c-832e-0410-b2c0-db6c5bc7c761
  • Loading branch information
tfwright committed Apr 20, 2007
1 parent baa7a08 commit b767d4e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
5 changes: 3 additions & 2 deletions jocha.js
@@ -1,6 +1,7 @@
Jocha = {
mocks : [],
verify : function(){ this.mocks.each(function(m){})}
mocks : new Array(),
// JSUnit specific
verifyAll : function(){ this.mocks.each(function(m){ assertTrue(m.verify())}) }
}
Jocha.Mock = Class.create();
Jocha.Mock.prototype = {
Expand Down
13 changes: 13 additions & 0 deletions test/jocha_test.html
Expand Up @@ -52,6 +52,19 @@
assertTrue(obj.verify());
}

function testVerifyAll() {
var obj1 = new Object();
var obj2 = new Object();
var obj3 = new Object();

obj1.expects("a")
obj2.expects("a").withParams("x")
obj3.expects("a").withParams(1)

assertEquals(3, Jocha.mocks.length)
// Ironically and pathetically, testing failure here will actually fail the test
}

</script>
</body>
</html>
Expand Down

0 comments on commit b767d4e

Please sign in to comment.