VoQn/js-practice — pull request #11 by VoQn (2012-07-06 11:56:14+00:00)
Title: BDD Style 'Topic'

## Example
``` coffeescript
# example tdd
test_suite_tdd = testGroup
'10 / 5 => 2':
expect(10 / 5).to_be 2
'complex test case': () ->
hoge = 5.3
expect(Math.round).when_apply(hoge).to_be 5

# example bdd
class Person
constructor: (@name, @age = 0) ->

Person::toString = () -> "Person named #{@name}, age #{@age}"
Person::greet = () -> "Hi! I'm #{@name}."
Person::tellAge = () -> "I'm #{@age} years old."

test_suite_person =
'person constructor': subject ((name, age) -> new Person(name, age)),
'make instance':
topic('Bob').to_be(Person 'Bob')
'check different age':
topic('Bob', 16).not_to_be Person('Bob', 23)

'example a person "tony"': subject Person('Tony', 15),
'he greets with his name': (he) ->
expect(he.greet()).to_be "Hi, I'm Tony."
'he tells me his age': (he) ->
expect(he.tellAge()).to_be "I'm 15 years old."
```