Sha256: f169870b195e24d1fad7d91f461ffb07ab170b117486462e9de2dda5897d6bf5

Contents?: true

Size: 1.38 KB

Versions: 9

Compression:

Stored size: 1.38 KB

Contents

// This is the only file that adds things to the global namespace. To
// simulate, in Node, the appearance of running in a browser, with
// files loaded by <script> tags

// Because it needs to pollute the global namespace, it has been
// written in JavaScript, because CoffeeScript protects the global
// namespace very effectively.

sinon = require('sinon');
underscore = require('underscore');
_ = underscore;

stubView = require('stubView.coffee').stubView;

tw = require('environment.spec_helper').tw;

function recursiveExtend(moduleToExtend, module) {
  _.each(module, function (value, key) {
    if (moduleToExtend[key] == null) moduleToExtend[key] = {};
    if (typeof value == "Object") {
      recursiveExtend(moduleToExtend[key], value);
    } else {
      _.extend(moduleToExtend[key], module[key]);
    }
  });
}

example = {};
recursiveExtend(example, require('controller.converter').example);

exports.stubView = stubView;
exports.tw = tw;
exports.appDir = __dirname + "/../app";
exports.example = example;

// Custom matchers:
beforeEach(function() {
  this.addMatchers({
    toBeEmpty: function() {
      if (typeof this.actual === "string") {
        return this.actual === "";
      } else if (_.isArray(this.actual)) {
        return _.isEmpty(this.actual);
      } else {
        return this.actual !== null && this.actual !== undefined && !this.actual.isEmpty();
      }
    }
  });
});

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
calatrava-0.6.6 lib/calatrava/templates/kernel/spec/spec_helper.js
calatrava-0.6.5 lib/calatrava/templates/kernel/spec/spec_helper.js
calatrava-0.6.4 lib/calatrava/templates/kernel/spec/spec_helper.js
calatrava-0.6.3 lib/calatrava/templates/kernel/spec/spec_helper.js
calatrava-0.6.2 lib/calatrava/templates/kernel/spec/spec_helper.js
calatrava-0.6.1 lib/calatrava/templates/kernel/spec/spec_helper.js
calatrava-0.6.0 lib/calatrava/templates/kernel/spec/spec_helper.js
calatrava-0.5.0 lib/calatrava/templates/kernel/spec/spec_helper.js
calatrava-0.0.1 lib/calatrava/templates/kernel/spec/spec_helper.js