@@ -56,7 +56,7 @@ describe('Given a container', function () {
5656 BAR_2 . dispose . reset ( )
5757 } )
5858
59- it ( 'should not release the instance if still in use' , function ( ) {
59+ it ( 'should not dispose the instance if still in use' , function ( ) {
6060 var firstRequest = container . get ( 'bar' )
6161 var secondRequest = container . get ( 'bar' )
6262
@@ -69,6 +69,27 @@ describe('Given a container', function () {
6969 expect ( container . get ( 'bar' ) ) . to . equal ( firstRequest )
7070 } )
7171
72+ describe ( 'and the instance does not have a dispose method' , function ( ) {
73+
74+ class Foo { }
75+
76+ beforeEach ( function ( ) {
77+ container = iniettore . create ( function ( context ) {
78+ context
79+ . map ( 'foo' ) . to ( Foo )
80+ . as ( TRANSIENT , SINGLETON , CONSTRUCTOR )
81+ } )
82+ container . get ( 'foo' )
83+ } )
84+
85+ it ( 'should not throw an Error' , function ( ) {
86+ function testCase ( ) {
87+ container . release ( 'foo' )
88+ }
89+ expect ( testCase ) . to . not . throw ( TypeError )
90+ } )
91+ } )
92+
7293 describe ( 'the same amount of times it has been acquired' , function ( ) {
7394
7495 it ( 'should release the instance, call dispose() method' , function ( ) {
@@ -117,7 +138,7 @@ describe('Given a container', function () {
117138 } )
118139 } )
119140
120- describe ( 'when releasing a persistent singleton' , function ( ) {
141+ describe ( 'when releasing a persistent singleton adn there is no more reference to the singleton ' , function ( ) {
121142
122143 before ( function ( ) {
123144 container = iniettore . create ( function ( context ) {
@@ -127,7 +148,7 @@ describe('Given a container', function () {
127148 } )
128149 } )
129150
130- it ( 'should have test coverage ' , function ( ) {
151+ it ( 'should not dispose the instance ' , function ( ) {
131152 container . get ( 'baz' )
132153 container . release ( 'baz' )
133154 expect ( BazDisposeSpy ) . to . not . be . called
0 commit comments