Module: Profiler::TestHelpers::RSpecSupport

Defined in:
lib/profiler/test_helpers/rspec_support.rb

Overview

RSpec integration for the profiler.

Usage in spec_helper.rb:

require 'profiler/test_helpers/rspec_support'
RSpec.configure do |config|
  Profiler::TestHelpers::RSpecSupport.install(config)
end

Class Method Summary collapse

Class Method Details

.install(config) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/profiler/test_helpers/rspec_support.rb', line 17

def self.install(config)
  config.around(:each) do |example|
    Profiler::TestProfiler.profile(
      test_name: example.full_description,
      test_file:  example.file_path,
      test_line:  example.line_number,
      framework:  :rspec
    ) { example.run }
  end

  config.after(:suite) do
    Profiler::TestHelpers::Reporter.print
  end
end