diff options
author | Henare Degan <henare.degan@gmail.com> | 2013-02-19 15:08:28 +1100 |
---|---|---|
committer | Henare Degan <henare.degan@gmail.com> | 2013-02-19 15:08:28 +1100 |
commit | 3f4e595d96b2932c07098435dbe28248b1852248 (patch) | |
tree | bf47f8614fdcbc321279a29dd16a01520102c4ed /spec/spec_helper.rb | |
parent | 1820c346e06fbd56a3a9b3c6b39b328084d08fa5 (diff) |
Speed up tests by brining the garbage collection hack over too
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r-- | spec/spec_helper.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index bcc00bec2..eaf77a909 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -73,6 +73,20 @@ Spork.prefork do ActionMailer::Base.deliveries = [] end + # This section makes the garbage collector run less often to speed up tests + last_gc_run = Time.now + + config.before(:each) do + GC.disable + end + + config.after(:each) do + if Time.now - last_gc_run > 4 + GC.enable + GC.start + last_gc_run = Time.now + end + end end # XXX No idea what namespace/class/module to put this in |