Shopify/batman — pull request #747 by kristianpd (2013-06-06 21:10:08+00:00)
Title: Test framework v1

Here's the start of our test framework.

Basic test classes built on top of QUnit and sinon that will give us the beginnings of a better test framework for developers.

## A few examples

`TestCase` will be the base of all test classes, holds basic assertions and setup and teardown.

```coffee
class FooTest extends Batman.TestCase
setup: ->
@foo = '1'
teardown: ->
#

@test "assert foo is 1", ->
@assertEqual 1, @foo
```
`ModelTestCase` the first of our specialized test classes for easier testing on various Batman components.

```coffee

class App.Foo extends Batman.Model
@encode 'title'
@encode 'baz',
decode: false
encode: (v) -> "!#{v}!"

class FooModelTest extends batman.ModelTestCase
setup: ->
@foo = App.Foo.createFromJSON({id: 1, title: "Hello"})

@test "FooModel deserialization keys", ->
@assertDecoders App.Foo, 'id', 'title'

@test "FooModel serialization keys", ->
@assertEncoders App.Foo, 'title', 'baz'

@test "FooModel custom encoder for baz", ->
@set 'baz', 'hello'
@assertEncoded @foo, 'baz', "!hello!"
```

To come: `ControllerTestCase`, `ViewTestCase`

## Documentation

I'll follow this up with some docs on the new site.

@hornairs @nickjs

/cc @SoapyIllusions @ibawt @matthelm

@zhubert, @TheJeff you guys may be interested in this one too.