On 17/03/10 2:29 PM, Pete Yandell wrote:
On 16 March 2010 17:54, Xavier Shay<[email protected]>  wrote:
- Either some sort of profiling, where machinist records object creation and
builds up a library (so first run will be just like normal, second run will
be optimized)

Now that would be cool!
hey guys stop trying to come up with big picture solutions!
code can solve all your problems!

http://github.com/xaviershay/machinist/tree/smart-fixtures

Ben H and I had a crack this evening. Totally Not Done. So broken on any real project we have. However!

It works for:

before(:suite) do
  Machinist.use_smart_fixtures = true
end

# Only two INSERT statement will be generated
100.times do |x|
 it("test #{x}") { User.make }
end

after(:each) do
  Machinist.smart_fixture_teardown!
end

...and we've pushed dinner back about as far as we can stand.

This version builds up the fixtures as the test suite runs, we also tried one that profiled the app and dumped out fixture data to a file but that was more complicated. See commit history if you're interested.

Xav + Ben

--
You received this message because you are subscribed to the Google Groups "Ruby or 
Rails Oceania" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en.

Reply via email to