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

Order rules by dependencies #72

Closed
nykolaslima opened this issue Jan 13, 2015 · 4 comments
Closed

Order rules by dependencies #72

nykolaslima opened this issue Jan 13, 2015 · 4 comments

Comments

@nykolaslima
Copy link
Member

Today we have the following problem:

Fixture.of(User.class).addTemplate("valid", new Rule() {{
add("email", "${name}@gmail.com");
add("name", random("nykolas", "otavio"));
}};

The above code fails because email depends on name but when email is evaluated, name was not evaluated yet.

@Tavio has solved this problem on Angular-Fixture-Factory(https://github.com/Tavio/angular-fixture-factory) project using Topological sort(http://en.wikipedia.org/wiki/Topological_sorting)
https://github.com/Tavio/angular-fixture-factory/blob/master/angular-fixture-factory.js#L264-L312

We can use the same approach here.

@Tavio
Copy link
Contributor

Tavio commented Jan 13, 2015

"Beware of bugs in the above code; I have only proved it correct, not tried it." - Knuth, Donald.

@ddomingues
Copy link
Contributor

This issue shouldn't be closed? @nykolaslima

And could you generate a new version with the PR #77?

@mahmoudimus
Copy link

This is indeed already merged via #77

@nykolaslima
Copy link
Member Author

Thank you guys.

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

4 participants