Skip to content
Browse files

Improved Smoke and Screw.Unit integration by having Smoke check expec…

…tations and reset mocks automatically after every test is ran.

Signed-off-by: Andy Kent <andrew.d.kent@gmail.com>
  • Loading branch information...
1 parent 3affbf6 commit 3ce48364bb8580af8f047db005f4a8b18376e6e5 Larry Karnowski committed with andykent Apr 12, 2009
Showing with 15 additions and 12 deletions.
  1. +15 −12 plugins/screw.mocking.js
View
27 plugins/screw.mocking.js
@@ -1,19 +1,22 @@
-// This is alightweight bridge between smoke and Screw.Unit
-// it shadows mocking and stubbing onto the matchers to make them available within tests
+// This is a lightweight bridge between Smoke and Screw.Unit.
+// It shadows mocking and stubbing onto the matchers to make them available within tests.
+
Screw.Matchers.mock = function(m) {
- return Smoke.Mock(m);
+ return Smoke.Mock(m);
};
-Screw.Matchers.stub = function(obj,attr) {
- return new Smoke.Stub(obj,attr);
+Screw.Matchers.stub = function(obj, attr) {
+ return new Smoke.Stub(obj,attr);
};
-Screw.Unit(function() {
- before(function() {
- Smoke.reset();
- });
+(function($) {
+ $(Screw).bind("before", function(){
+ function checkAndResetSmoke() {
+ Smoke.checkExpectations();
+ Smoke.reset();
+ }
- after(function() {
- Smoke.checkExpectations();
+ $('.it').bind('passed', function(){ checkAndResetSmoke() });
+ $('.it').bind('failed', function(){ checkAndResetSmoke() });
});
-});
+})(jQuery);

0 comments on commit 3ce4836

Please sign in to comment.
Something went wrong with that request. Please try again.