diff --git a/tests/specs/integration/BaseEntity/Relationships/HasManySpec.cfc b/tests/specs/integration/BaseEntity/Relationships/HasManySpec.cfc index b0e61399..2e543b6a 100644 --- a/tests/specs/integration/BaseEntity/Relationships/HasManySpec.cfc +++ b/tests/specs/integration/BaseEntity/Relationships/HasManySpec.cfc @@ -112,6 +112,16 @@ component extends="tests.resources.ModuleIntegrationSpec" { expect( user.fresh().getPosts() ).toHaveLength( 3 ); } ); + it( "deletes related entities using the actual foreign key value", function() { + var user = getInstance( "User" ).findOrFail( 1 ); + expect( user.posts().count() ).toBe( 2 ); + + user.posts().deleteAll(); + + expect( getInstance( "Post" ).where( "user_id", 1 ).count() ).toBe( 0 ); + expect( getInstance( "Post" ).where( "user_id", 4 ).count() ).toBeGT( 0 ); + } ); + it( "can first off of the relationship", function() { var user = getInstance( "User" ).find( 1 ); var post = user.posts().first();