Class: RailsTestServing::Cleaner

Inherits:
Object
  • Object
show all
Includes:
ConstantManagement
Defined in:
lib/rails_test_serving/cleaner.rb

Constant Summary collapse

PAUSE =
0.01
TESTCASE_CLASS_NAMES =
%w( Test::Unit::TestCase
ActiveSupport::TestCase
ActionView::TestCase
ActionController::TestCase
ActionController::IntegrationTest
ActionMailer::TestCase )

Instance Method Summary collapse

Methods included from ConstantManagement

#constantize, #constantize!, #legit?, #remove_constants, #subclasses_of

Constructor Details

#initializeCleaner



13
14
15
# File 'lib/rails_test_serving/cleaner.rb', line 13

def initialize
  start_worker
end

Instance Method Details

#clean_up_aroundObject



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/rails_test_serving/cleaner.rb', line 17

def clean_up_around
  check_worker_health
  sleep PAUSE while @working
  begin
    reload_app
    yield
  ensure
    @working = true
    sleep PAUSE until @worker.stop?
    @worker.wakeup
  end
end