Class: TuneMyGc::Spies::Rspec

Inherits:
Base
  • Object
show all
Defined in:
lib/tunemygc/spies/rspec.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



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/tunemygc/spies/rspec.rb', line 31

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

    def tunemygc_after_teardown
      # noop
    end
  end
end

#hooks_moduleObject



22
23
24
25
26
27
28
29
# File 'lib/tunemygc/spies/rspec.rb', line 22

def hooks_module
  Module.new do
    RSpec.configure do |c|
      c.before(:all) { TuneMyGc.processing_started }
      c.after(:all) { TuneMyGc.processing_ended }
    end
  end
end

#installObject



12
13
14
15
# File 'lib/tunemygc/spies/rspec.rb', line 12

def install
  RSpec::Core.__send__(:include, hooks_module)
  TuneMyGc.log "hooked: rspec"
end

#uninstallObject



17
18
19
20
# File 'lib/tunemygc/spies/rspec.rb', line 17

def uninstall
  RSpec::Core.__send__(:include, disabled_hooks_module)
  TuneMyGc.log "uninstalled rspec spy"
end