Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$.fixture.make always filters out any fixtures when 'parentId'-like param is present #132

Open
LazyDev2k opened this issue Jun 6, 2012 · 0 comments

Comments

@LazyDev2k
Copy link
Contributor

Fixture function created by $.fixture.make filters out any fixtures when request parameter contain "Id" or "_id" string and there is no way to turn this off.

Code from dom/fixture/fixture.js:

if ( settings.data[param] !== undefined && // don't do this if the value of the param is null (ignore it)
    (param.indexOf("Id") != -1 || param.indexOf("_id") != -1) ) {
    while ( i < retArr.length ) {
        if ( settings.data[param] != retArr[i][param] ) {
            retArr.splice(i, 1);
        } else {
            i++;
        }
    }
}

The idea of automatic filter by id-like parameter is OK but this feature should be optional.

Example of problem test case:
We have something like MyModel.findAll({parentId: xxx}) in our code but we don't have parentId property on MyModel class. For us parentId is just search parameter. We handle it in our custom filter passed to $.fixture.make. However code from fixutre.js filters out all our fixtures because they don't have parentId property and we can't turn this behavior off.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant