Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions tests/specs/integration/BaseEntity/Relationships/HasManySpec.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading