six2six / fixture-factory

Generator fake objects from a template
Apache License 2.0
445 stars 88 forks source link

Persistent gimme #33

Closed nykolaslima closed 11 years ago

nykolaslima commented 11 years ago

For integration tests we need our fixtures to be persisted in database. Setup this tests is painful, we can make it easy through fixture-factory.

Fixture.of(Client.class, session).gimme("valid")

This initial support is made through Hibernate.

What do you guys think about it? @aparra @douglasrodrigo @ahirata

ahirata commented 11 years ago

Hey @nykolaslima, I'm sorry for not answering this before. I missed the pull request notification for some reason.

I believe if we were to provide any kind of support for 3rd party frameworks, it shouldn't be like this. The main problem is that the Session is now in almost all of our core classes when it should be somehow isolated from them. I'll have a better look at this later and see if I can come up with something.

And just to give some code review feedback, you duplicated some code on PersistentObjectFactory. But I just skimmed thorugh so I'm not sure if it was just "copy&paste" or if it requires a little bit of work. =)

nykolaslima commented 11 years ago

Arthur, thank you for your feedback.

I agree with you that we should isolate it somehow. I'm already using it in a project, but we should refactory it.

I will think in a better solution too.