Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

README: added Smoke mocking example

  • Loading branch information...
commit b02dadeeefd371891ee187d75b22a874f6bc5dfb 1 parent d930ac3
Larry Karnowski authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 README.markdown
8 README.markdown
@@ -155,8 +155,14 @@ Note that if you have `rlwrap` installed and on the command line path (and you r
Mocking Example with Smoke
+Smoke is a JavaScript mocking and stubbing toolkit that is somewhat similar to FlexMock or Mocha. It is automatically wired-in to undo its mocking after each Screw.Unit `it` block. Here's an example.
+ it("calculates the total cost of a contract by adding the prices of each component", function() {
+ var componentX = {}, componentY = {};
+ mock(SalesContract).should_receive("calculateComponentPrice").with_arguments(componentX).exactly(1, "times").and_return(42);
+ mock(SalesContract).should_receive("calculateComponentPrice").with_arguments(componentY).exactly(1, "times").and_return(24);
+ expect(SalesContract.calculateTotalCost([componentX, componentY])).to(equal, 66);
+ });
Tips & Tricks
Please sign in to comment.
Something went wrong with that request. Please try again.