Skip to content

Commit

Permalink
Updated the mock object / interaction section
Browse files Browse the repository at this point in the history
  • Loading branch information
keronsen committed Nov 6, 2009
1 parent 89828e2 commit 875cbcf
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions README.textile
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,16 @@ bc. jack(function(){
storeSomething();
});

h3. Creating a mock object
h3. Creating a mock object for testing interaction

If you want to test how your code under test interacts with other objects, you can create a mock object with @jack.create()@:

bc. jack(function(){
var services = jack.create("services", ['serviceOne','serviceTwo']);
jack.expect("services.serviceOne")
var myStack = jack.create("myStack", ['push','pop']);
jack.expect("myStack.push")
.exactly("1 time")
.whereArgument(0).is("something");
useServices(services);
useTheStack(myStack);
});


Expand Down

0 comments on commit 875cbcf

Please sign in to comment.