Skip to content

Instantly share code, notes, and snippets.

@zakuni
Last active December 18, 2015 13:39
Show Gist options
  • Select an option

  • Save zakuni/5791841 to your computer and use it in GitHub Desktop.

Select an option

Save zakuni/5791841 to your computer and use it in GitHub Desktop.
define () ->
class Camera
take: ->
# do nothing
define ['camera', 'mocha', 'chai'], (Camera, mocha, chai) ->
assert = chai.assert
suite 'Camera', () ->
camera = new Camera()
suite '#Camera', () ->
test 'is instance of Camera', () ->
assert.instanceOf(camera, Camera)
suite '#take()', () ->
test 'is function', () ->
assert.isFunction(camera.take)
requirejs.config
paths:
mocha: '../components/mocha/mocha'
chai: '../components/chai/chai'
camera: '../camera'
shim:
'mocha':
init: () ->
this.mocha.setup('tdd')
return this.mocha
require ['camera', 'mocha', 'chai', 'test.camera'], (Camera) ->
mocha.run()
<html>
<head>
<meta charset="utf-8">
<title>Mocha Tests</title>
<link rel="stylesheet" href="../components/mocha/mocha.css" />
</head>
<body>
<div id="mocha"></div>
<script src="../components/chai/chai.js"></script>
<script src="../components/mocha/mocha.js"></script>
<script src="../components/requirejs/require.js" data-main="test"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment