Skip to content

Commit

Permalink
specs can be run with mocha
Browse files Browse the repository at this point in the history
  • Loading branch information
kristianmandrup committed Apr 27, 2012
1 parent dabb426 commit 628d1e6
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 40 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.DS_Store
sandbox
.jhw-cache
npm-debug.log
npm-debug.log
node_modules
32 changes: 9 additions & 23 deletions lib/beer_can.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
(function() {
var BeerCan,
__hasProp = Object.prototype.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
var BeerCan;

console.log('Drinking a Beer Can :)');

Array.prototype.remove = function(e) {
var t;
if ((t = this.indexOf(e)) > -1) return this.splice(t, 1)[0];
if ((t = this.indexOf(e)) > -1) {
return this.splice(t, 1)[0];
}
};

BeerCan = {};
module.exports = global.BeerCan = BeerCan = {};

require('./beer_can/rule');

Expand All @@ -22,24 +22,10 @@

require('./beer_can/model_mixin');

if (typeof Tower !== "undefined" && Tower !== null) require('./beer_can/tower');

BeerCan.RuleResult = (function(_super) {

__extends(RuleResult, _super);

function RuleResult() {
RuleResult.__super__.constructor.apply(this, arguments);
}

RuleResult.prototype.byThe = function(relation) {};

RuleResult.prototype.byAny = function(models) {};

return RuleResult;

})(Boolean);
if (typeof Tower !== "undefined" && Tower !== null) {
require('./beer_can/tower');
}

module.exports = BeerCan;
console.log('Exported BeerCan module as global');

}).call(this);
23 changes: 23 additions & 0 deletions lib/beer_can/rule_result.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions lib/beer_can/tower.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
(function() {

require('.tower/controller');
require('./tower/controller');

require('.tower/model');
require('./tower/model');

require('.tower/view');
require('./tower/view');

}).call(this);
2 changes: 1 addition & 1 deletion lib/beer_can/tower/controller.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@
"async": ">= 0.1.18"
},
"scripts": {
"test": "mocha spec/coffee/config.coffee $(find spec/coffee -name "*spec.coffee") -r coffee-script $@"
"test": "mocha spec/coffee/config.coffee $(find spec/coffee -name \"*_spec.coffee\") -r coffee-script $@"
}
}
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ Run

## Running tests with mocha

Install mocha
Install all dependencies from `package.json`:

`npm install mocha -g
`npm install`

Run

Expand Down
10 changes: 1 addition & 9 deletions src/beer_can.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,14 @@ console.log 'Drinking a Beer Can :)'
Array::remove = (e) -> @splice(t, 1)[0] if (t = @indexOf(e)) > -1

# top level namespace
BeerCan = {}

class BeerCan.RuleResult extends Boolean
byThe: (relation) ->
# ...
byAny: (models) ->
# ...

module.exports = global.BeerCan = BeerCan = {};

require './beer_can/rule'
require './beer_can/ability'
require './beer_can/api'
require './beer_can/mixin'
require './beer_can/model_mixin'

require './beer_can/tower' if Tower?

console.log 'Exported BeerCan module as global'

5 changes: 5 additions & 0 deletions src/beer_can/rule_result.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class BeerCan.RuleResult extends Boolean
byThe: (relation) ->
# ...
byAny: (models) ->
# ...

0 comments on commit 628d1e6

Please sign in to comment.