Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

a better example of mocking anonymous functions

  • Loading branch information...
commit 1b5053e96970fda06cd1b42c1bcd09a27628c6cb 1 parent 2bf527b
@andykent andykent authored
Showing with 4 additions and 3 deletions.
  1. +4 −3 README.markdown
7 README.markdown
@@ -18,9 +18,10 @@ but you will need to include the Smoke files and you can get straight to work us
Additionally Smoke now has a macro for mocking anonymous functions this is great for mocking and stubbing closures...
- f = mock_function(function () { return 'Hi!' });
- f.should_be_invoked().exactly('once');
- expect(f()).to(equal, 'hi!');
+ callback = mock_function();
+ callback.should_be_invoked().exactly('once');
+ $.bind('click', callback);
+ $.trigger('click');
Getting Started (Free Standing)
Please sign in to comment.
Something went wrong with that request. Please try again.