Skip to content

Commit

Permalink
Feature: Added vows' tests: 'grunt test'
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Roth <christian.roth@port17.de>
Rate limit · GitHub

Access has been restricted

You have triggered a rate limit.

Please wait a few minutes before you try again;
in some cases this may take up to an hour.

cr0 committed Jun 16, 2013
1 parent 95e2327 commit b0daaa7
Showing 5 changed files with 61 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.test
app
doc
node_modules
35 changes: 30 additions & 5 deletions Gruntfile.coffee
Original file line number Diff line number Diff line change
@@ -2,31 +2,56 @@ module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'

clean:
server:
src: ['app']
test:
src: ['.test']

coffee:
server:
options:
sourceMap: true
files: [
expand: true
flatten: true
cwd: 'src/'
src: ['**/*.coffee']
dest: 'app'
ext: '.js'
]
test:
files: [
expand: true
cwd: 'test/'
src: ['**/*.coffee']
dest: '.test'
ext: '.js'
]

vows:
server:
options:
reporter: 'spec'
src: ['.test/js/*.js']

watch:
coffee:
files: ['**/*.coffee']
tasks: 'coffee'
files: ['**/*.coffee']
tasks: 'coffee'


grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-vows'
grunt.loadNpmTasks 'grunt-contrib-watch'

grunt.registerTask 'build', [
'coffee'
]
'clean:server', 'coffee:server'
]

grunt.registerTask 'test', [
'clean:test', 'coffee:test', 'vows:server', 'clean:test'
]

grunt.registerTask 'server', [
'coffee', 'watch:coffee'
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
# node-galerie

[![Build Status](https://travis-ci.org/cr0/node-galerie.png?branch=master)](https://travis-ci.org/cr0/node-galerie)
# node-galerie [![Build Status](https://travis-ci.org/cr0/node-galerie.png?branch=master)](https://travis-ci.org/cr0/node-galerie)
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
"scripts": {
"install": "grunt build",
"start": "npm start",
"test": "vows --spec"
"test": "grunt test"
},
"repository": {
"type": "git",
@@ -32,9 +32,12 @@
"jade": "0.31.x",
"grunt": "0.4.x",
"grunt-cli": "0.1.x",
"grunt-contrib-coffee": "0.7.x"
"grunt-contrib-coffee": "0.7.x",
"grunt-contrib-clean": "~0.4.1"
},
"devDependencies": {
"grunt-contrib-watch": "0.4.x"
"grunt-contrib-watch": "0.4.x",
"grunt-vows": "~0.4.x",
"vows": "0.7.x"
}
}
23 changes: 23 additions & 0 deletions test/indexTest.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
vows = require 'vows'
assert = require 'assert'

vows
.describe('Division by zero')
.addBatch
'when dividing a number by zero':
topic: -> 42/ 0

'we get Infinity': (topic) ->
assert.equal topic, Infinity

'but when dividing zero by zero':
topic: -> 0 / 0

'we get a value which':
'is not a number': (topic) ->
assert.isNaN topic

'is not equal to itself': (topic) ->
assert.notEqual topic, topic

.export(module)

0 comments on commit b0daaa7

Please sign in to comment.