You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 15, 2021. It is now read-only.
After reading the recent blog post at http://collectiveidea.com/blog/archives/2014/08/06/time-to-bring-back-fixtures/, I was intrigued by some of the ideas. For example, nearly every single one of my fabricators references some account or user or other "owner" object, which results in lots of extra records created and time wasted.
Fabricator:widgetdoaccountname{ ... }end
I also often times want to create several "sibling" objects with the same account, which requires a bit more boilerplate:
I think by having that initial account defined as a fixture would solve both problems, first by only ever creating the one account, and having all fabricators default to using it:
I spent a little bit of time trying to hack this together, but failed. The issue was making the Rails #accounts fixture helper available in the fabrication Runner. But before I spent too much time on this, I wanted to get your opinion on if this was even a good idea, and if so, any feedback on how best to accomplish this.
I was hoping it would be something as simple as Fabrication::Schematic::Runner.send(:include, ActiveRecord::TestFixtures), but no dice. Any tips?
Thanks,
Paul
The text was updated successfully, but these errors were encountered:
This is a great idea. The Account use case is extremely common. It would be important to have an override as well, (for example a use case where you're testing 2 different accounts. "User views only their account information" -- etc.
What was the failure you got on the Fabrication::Schematic::Runner.send(:include, ActiveRecord::TestFixtures)?
I don't particularly want to include all of Rails, which seems to be what I need to do to make it work in the test suite. The bigger problem was in the implementation itself though. What essentially needs to happen is we add a method to Fabrication::Schematic::Evaluator that provides access to the fixtures. It doesn't seem to be as straightforward as I was hoping.
This is from a thread on the google group: https://groups.google.com/forum/#!topic/fabricationgem/9dJznFRCG74
Hello,
After reading the recent blog post at http://collectiveidea.com/blog/archives/2014/08/06/time-to-bring-back-fixtures/, I was intrigued by some of the ideas. For example, nearly every single one of my fabricators references some account or user or other "owner" object, which results in lots of extra records created and time wasted.
I also often times want to create several "sibling" objects with the same account, which requires a bit more boilerplate:
I think by having that initial account defined as a fixture would solve both problems, first by only ever creating the one account, and having all fabricators default to using it:
I spent a little bit of time trying to hack this together, but failed. The issue was making the Rails
#accounts
fixture helper available in the fabrication Runner. But before I spent too much time on this, I wanted to get your opinion on if this was even a good idea, and if so, any feedback on how best to accomplish this.I was hoping it would be something as simple as
Fabrication::Schematic::Runner.send(:include, ActiveRecord::TestFixtures)
, but no dice. Any tips?Thanks,
Paul
The text was updated successfully, but these errors were encountered: