TheLudd / mocha-gwt

Given When Then for mocha
5 stars 2 forks source link

doesn't play nice with "context" alias #5

Closed ghost closed 9 years ago

ghost commented 9 years ago

In the spec DSL, context is an alias for describe. However, mocha-gwt only wraps describe; using context can result in crosstalk between specs. For example:

 describe 'context bug', ->
   describe 'describes', ->
     describe 'A', ->
       When -> @result = 'abc'
       Then -> @result == 'abc'
     describe 'B', ->
       When -> @result = '123'
       Then -> @result == '123'

   describe 'contexts', ->
     context 'A', ->
       When -> @result = 'abc'
       Then -> @result == 'abc'
     context 'B', ->
       When -> @result = '123'
       Then -> @result == '123'

Fails with:

  1) context bug contexts then this.result === 'abc':

      Expected Expected 123 === abc
      + expected - actual

      -123
      +abc

  Error