Created
March 21, 2009 04:45
-
-
Save quirkey/82730 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function($) { | |
| $.extend(jqUnit, { | |
| // like rspec/bacon describe, sort of | |
| describe: function() { | |
| var args = [].splice.call(arguments, 0); | |
| return jqUnit.module('describe: ' + args.join(' ')); | |
| }, | |
| // shortcut to append 'should' to tests | |
| should: function(name, callback, nowait) { | |
| return jqUnit.test('should ' + name, callback, nowait); | |
| }, | |
| // asserts that the method is defined (like respond_to?) | |
| defined: function(object, method) { | |
| return jqUnit.ok(typeof object[method] != 'undefined', method + 'is not defined on' + object); | |
| }, | |
| // asserts that the object is of a certain type | |
| isType: function(object, type) { | |
| return jqUnit.ok(object.constructor === type, object + 'is not of type' + type); | |
| } | |
| }); | |
| })(jQuery); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function($) { | |
| with(jqUnit) { | |
| describe('My.Application', 'init'); | |
| should('initialize with function', function() { | |
| ok(true); | |
| }); | |
| should('return an application object', function() { | |
| ok(true); | |
| }); | |
| describe('My.Application', 'foo'); | |
| should('be awesome', function() { | |
| ok(true); | |
| }); | |
| } | |
| })(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment