Class: TuneMyGc::Spies::Minitest

Inherits:
Base
  • Object
show all
Defined in:
lib/tunemygc/spies/minitest.rb

Instance Method Summary collapse

Methods inherited from Base

#check_uninstall, #initialize

Constructor Details

This class inherits a constructor from TuneMyGc::Spies::Base

Instance Method Details

#disabled_hooks_moduleObject



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/tunemygc/spies/minitest.rb', line 41

def disabled_hooks_module
  Module.new do
    private
    def tunemygc_before_setup
      # noop
    end

    def tunemygc_after_teardown
      # noop
    end
  end
end

#hooks_moduleObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/tunemygc/spies/minitest.rb', line 18

def hooks_module
  Module.new do
    def before_setup
      tunemygc_before_setup
      super
    end

    def after_teardown
      super
      tunemygc_after_teardown
    end

    private
    def tunemygc_before_setup
      TuneMyGc.processing_started
    end

    def tunemygc_after_teardown
      TuneMyGc.processing_ended
    end
  end
end

#installObject



8
9
10
11
# File 'lib/tunemygc/spies/minitest.rb', line 8

def install
  MiniTest::Unit::TestCase.__send__(:include, hooks_module)
  TuneMyGc.log "hooked: minitest"
end

#uninstallObject



13
14
15
16
# File 'lib/tunemygc/spies/minitest.rb', line 13

def uninstall
  MiniTest::Unit::TestCase.__send__(:include, disabled_hooks_module)
  TuneMyGc.log "uninstalled minitest spy"
end