Permalink
Browse files

Merge pull request #194 from chaplinjs/topics/test-style

Testing style
  • Loading branch information...
2 parents 5048923 + 6cdfa8c commit 7f48ab89bf7a51c0e42f4efff1fabcf03ba7fbf5 @paulmillr paulmillr committed Sep 16, 2012
@@ -39,15 +39,15 @@ define [
passedMatch = match
expect(app.initRouter).to.be.a 'function'
- expect(app.initRouter.length).to.equal 2
+ expect(app.initRouter.length).to.be 2
app.initRouter routes, root: '/'
expect(app.router).to.be.a Router
- expect(routesCalled).to.be.ok()
+ expect(routesCalled).to.be true
expect(passedMatch).to.be.a 'function'
it 'should start Backbone.history', ->
- expect(Backbone.History.started).to.be.ok()
+ expect(Backbone.History.started).to.be true
it 'should dispose itself correctly', ->
expect(app.dispose).to.be.a 'function'
@@ -56,9 +56,9 @@ define [
for prop in ['dispatcher', 'layout', 'router']
expect(_(app).has prop).to.not.be.ok()
- expect(app.disposed).to.be.ok()
+ expect(app.disposed).to.be true
if Object.isFrozen
- expect(Object.isFrozen(app)).to.be.ok()
+ expect(Object.isFrozen(app)).to.be true
it 'should be extendable', ->
expect(Application.extend).to.be.a 'function'
@@ -20,25 +20,25 @@ define [
expectOrder = (order) ->
for id, index in order
- expect(collection.at(index).id).to.equal id
+ expect(collection.at(index).id).to.be id
it 'should mixin a EventBroker', ->
for own name, value of EventBroker
- expect(collection[name]).to.equal EventBroker[name]
+ expect(collection[name]).to.be EventBroker[name]
it 'should initialize a Deferred', ->
expect(collection.initDeferred).to.be.a 'function'
collection.initDeferred()
for method in ['done', 'fail', 'progress', 'state', 'promise']
- expect(typeof collection[method]).to.equal 'function'
- expect(collection.state()).to.equal 'pending'
+ expect(typeof collection[method]).to.be 'function'
+ expect(collection.state()).to.be 'pending'
it 'should initialize a SyncMachine', ->
_.extend collection, SyncMachine
for own name, value of SyncMachine
if typeof value is 'function'
- expect(collection[name]).to.equal value
- expect(collection.syncState()).to.equal 'unsynced'
+ expect(collection[name]).to.be value
+ expect(collection.syncState()).to.be 'unsynced'
it 'should add models atomically', ->
expect(collection.addAtomic).to.be.a 'function'
@@ -86,8 +86,8 @@ define [
collection.update ({id: i} for i in newOrder)
expectOrder newOrder
- expect(addSpy.callCount).to.equal 3
- expect(removeSpy.callCount).to.equal 3
+ expect(addSpy.callCount).to.be 3
+ expect(removeSpy.callCount).to.be 3
expect(resetSpy).was.notCalled()
it 'should update models deeply', ->
@@ -100,24 +100,24 @@ define [
for id in [1, 3, 5]
model = collection.get id
- expect(model.get('old1')).to.be.ok()
- expect(model.get('old2')).to.be.ok()
- expect(model.get('new')).to.be.ok()
+ expect(model.get('old1')).to.be true
+ expect(model.get('old2')).to.be true
+ expect(model.get('new')).to.be true
for id in [7, 9, 11]
model = collection.get id
- expect(model.get('old1')).to.equal undefined
- expect(model.get('old2')).to.be.ok()
- expect(model.get('new')).to.be.ok()
+ expect(model.get('old1')).to.be undefined
+ expect(model.get('old2')).to.be true
+ expect(model.get('new')).to.be true
it 'should dispose itself correctly', ->
expect(collection.dispose).to.be.a 'function'
collection.dispose()
- expect(collection.length).to.equal 0
+ expect(collection.length).to.be 0
- expect(collection.disposed).to.be.ok()
+ expect(collection.disposed).to.be true
if Object.isFrozen
- expect(Object.isFrozen(collection)).to.be.ok()
+ expect(Object.isFrozen(collection)).to.be true
it 'should fire a dispose event', ->
disposeSpy = sinon.spy()
@@ -152,7 +152,7 @@ define [
collection.dispose()
- expect(collection.state()).to.equal 'rejected'
+ expect(collection.state()).to.be 'rejected'
expect(failSpy).was.called()
it 'should remove instance properties', ->
Oops, something went wrong.

0 comments on commit 7f48ab8

Please sign in to comment.