Skip to content

Commit

Permalink
Add tests for afterBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLudd committed Sep 10, 2015
1 parent f12a01e commit de04ed1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 1 addition & 2 deletions lib/mocha-gwt.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,8 @@ mochaGWT = (suite) ->

s = Suite.create fileParent, block.getTitle()
block.getBefores().forEach (b) -> s.beforeAll '', b unless shouldSkip
block.getAfterBlocks().forEach (ab) -> s.afterAll '', ab unless shouldSkip

block.getTests().forEach (t) ->
block.getTests().concat(block.getAfterBlocks()).forEach (t) ->
title = 'then ' + descibeFunction t
test = new Test title, ->
try
Expand Down
3 changes: 3 additions & 0 deletions test/e2e/mocha-gwt-test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,12 @@ describe 'mocha-gwt', ->

describe 'after is called after its block', ->
foo = undefined
thisFoo = undefined
Given -> foo = 1 unless foo?
Given -> @localFoo = 'foo'
Then -> foo == 1
afterBlock -> foo = 2
afterBlock -> @localFoo == 'foo'

describe 'after should have been called', ->
Then -> foo == 2
Expand Down

0 comments on commit de04ed1

Please sign in to comment.