Skip to content

Commit

Permalink
(- tests fix) Adding a regression for constructor-forwarding.
Browse files Browse the repository at this point in the history
... unfortunately, it doesn't seem to have caught the problem. Meh.
  • Loading branch information
ELLIOTTCABLE committed May 27, 2013
1 parent 09dc7ba commit 88901d1
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion Test/utility.tests.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,32 @@ describe "Paws' utilities:", ->
expect(func().parent_called).to.not.be true
it 'should return an instance of the passed class', ->
expect(func()).to.be.a Child


it 'should not prevent constructor-forwarding /re', ->
class Ancestor
constructor: -> @ancestor_called = yes
class Parent extends Ancestor
constructor: (forward) ->
return new Child if forward
it = construct this
it.parent_called = yes
return it
class Child extends Parent
constructor: ->
it = construct this
it.child_called = yes
return it

expect(-> new Parent yes).to.not.throwException()
expect(new Parent yes).to.be.a Child
expect(new Parent yes).to.be.a Parent

child = new Parent yes
expect(child.ancestor_called).to.be.ok()
expect(child.parent_called) .to.be.ok()
expect(child.child_called) .to.be.ok()


describe 'parameterizable()', ->
utilities.parameterizable class Twat
constructor: -> return this
Expand Down

0 comments on commit 88901d1

Please sign in to comment.