Skip to content

Commit

Permalink
fix(Relationships): correct detach function name
Browse files Browse the repository at this point in the history
* Correct detach function name (changed detatch to detach)
* Rename detatch to detach in tests
  • Loading branch information
richardherbert authored and elpete committed Jul 2, 2018
1 parent 3125e6b commit 5dceb17
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion models/Relationships/BelongsToMany.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ component accessors="true" extends="quick.models.Relationships.BaseRelationship"
return this;
}

function detatch( ids ) {
function detach( ids ) {
if ( ! isArray( arguments.ids ) ) {
arguments.ids = [ arguments.ids ];
}
Expand Down
8 changes: 4 additions & 4 deletions tests/specs/integration/BaseEntity/SaveSpec.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,15 @@ component extends="tests.resources.ModuleIntegrationSpec" appMapping="/app" {
} );

describe( "detach", function() {
it( "can detatch an id from a relationship", function() {
it( "can detach an id from a relationship", function() {
var post = getInstance( "Post" ).find( 1 );

expect( post.getTags().toArray() ).toBeArray();
expect( post.getTags().toArray() ).toHaveLength( 2 );

var tag = post.getTags().toArray()[ 1 ];

post.tags().detatch( tag.getId() );
post.tags().detach( tag.getId() );

expect( post.getTags().toArray() ).toBeArray();
expect( post.getTags().toArray() ).toHaveLength( 1 );
Expand All @@ -153,7 +153,7 @@ component extends="tests.resources.ModuleIntegrationSpec" appMapping="/app" {

var tag = post.getTags().toArray()[ 1 ];

post.tags().detatch( tag );
post.tags().detach( tag );

expect( post.getTags().toArray() ).toBeArray();
expect( post.getTags().toArray() ).toHaveLength( 1 );
Expand All @@ -166,7 +166,7 @@ component extends="tests.resources.ModuleIntegrationSpec" appMapping="/app" {
expect( tags ).toBeArray();
expect( tags ).toHaveLength( 2 );

post.tags().detatch( [ tags[ 1 ].getId(), tags[ 2 ] ] );
post.tags().detach( [ tags[ 1 ].getId(), tags[ 2 ] ] );

expect( post.getTags().toArray() ).toBeArray();
expect( post.getTags().toArray() ).toBeEmpty();
Expand Down

0 comments on commit 5dceb17

Please sign in to comment.