Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- describe('JavaScript', function() {
- it('is awesome', function() {
- expect('awesome as hell').toBeAwesome('as hell');
- });
- });
- jasmine.getEnv().beforeEach(function() {
- spyOn(require('child_process'), 'spawn');
- this.addMatchers({
- toBeAwesome: function(expectedAwesomeness) {
- return this.actual == 'awesome ' + expectedAwesomeness;
- },
- });
- });
- describe('jasmine spies', function() {
- it('can be single functions', function() {
- var aFunction = jasmine.createSpy('a function')
- aFunction('hello function')
- expect(aFunction).toHaveBeenCalledWith('hello function');
- });
- it('can be entire objects', function() {
- var mockObject = jasmine.createSpyObj('an object', ['aFunction', 'anotherFunction']);
- mockObject.aFunction('hello object');
- mockObject.anotherFunction();
- expect(mockObject.aFunction).toHaveBeenCalledWith('hello object');
- expect(mockObject.anotherFunction).toHaveBeenCalled();
- });
- });
- var fs = require('fs');
- var path = require('path');
- var jsdir = path.dirname(fs.realpathSync(__filename));
- require.paths.unshift(path.join(jsdir, "../public"));
- var horseman = require('horseman');
- horseman.autoReload(
- 'js/utils/jquery-1.6.min',
- function() {
- delete global.$;
- global.$ = window.$;
- global.jQuery = window.jQuery;
- }
- );
- exports.buildWindow = function() {
- horseman.buildWindow('public/index.html');
- };
- exports.buildWindow();
- global._ = require('js/utils/underscore-min')._;
- jasmine.getEnv().beforeEach(exports.buildWindow);
Add Comment
Please, Sign In to add comment