Guest User

Untitled

a guest
Jan 23rd, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. describe('JavaScript', function() {
  2. it('is awesome', function() {
  3. expect('awesome as hell').toBeAwesome('as hell');
  4. });
  5. });
  6.  
  7.  
  8.  
  9. jasmine.getEnv().beforeEach(function() {
  10. spyOn(require('child_process'), 'spawn');
  11. this.addMatchers({
  12. toBeAwesome: function(expectedAwesomeness) {
  13. return this.actual == 'awesome ' + expectedAwesomeness;
  14. },
  15. });
  16. });
  17.  
  18. describe('jasmine spies', function() {
  19. it('can be single functions', function() {
  20. var aFunction = jasmine.createSpy('a function')
  21. aFunction('hello function')
  22. expect(aFunction).toHaveBeenCalledWith('hello function');
  23. });
  24.  
  25. it('can be entire objects', function() {
  26. var mockObject = jasmine.createSpyObj('an object', ['aFunction', 'anotherFunction']);
  27.  
  28. mockObject.aFunction('hello object');
  29. mockObject.anotherFunction();
  30.  
  31. expect(mockObject.aFunction).toHaveBeenCalledWith('hello object');
  32. expect(mockObject.anotherFunction).toHaveBeenCalled();
  33. });
  34. });
  35.  
  36. var fs = require('fs');
  37. var path = require('path');
  38. var jsdir = path.dirname(fs.realpathSync(__filename));
  39. require.paths.unshift(path.join(jsdir, "../public"));
  40.  
  41. var horseman = require('horseman');
  42. horseman.autoReload(
  43. 'js/utils/jquery-1.6.min',
  44. function() {
  45. delete global.$;
  46. global.$ = window.$;
  47. global.jQuery = window.jQuery;
  48. }
  49. );
  50.  
  51. exports.buildWindow = function() {
  52. horseman.buildWindow('public/index.html');
  53. };
  54. exports.buildWindow();
  55.  
  56. global._ = require('js/utils/underscore-min')._;
  57.  
  58. jasmine.getEnv().beforeEach(exports.buildWindow);
Add Comment
Please, Sign In to add comment