Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added verifyAll to Jocha obj method and sort of tested it

git-svn-id: file:///Users/jyurek/Backups/repositories/jocha/trunk@14 5317845c-832e-0410-b2c0-db6c5bc7c761
  • Loading branch information...
commit b767d4e852311220f03062521e19f59b7b3ffc86 1 parent baa7a08
tfwright authored
Showing with 16 additions and 2 deletions.
  1. +3 −2 jocha.js
  2. +13 −0 test/jocha_test.html
5 jocha.js
View
@@ -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 = {
13 test/jocha_test.html
View
@@ -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>
Please sign in to comment.
Something went wrong with that request. Please try again.