Sha256: 640581a76375e6d4b869a2357e4585cab9c2c5840c88ec3672c345becef8b16b

Contents?: true

Size: 743 Bytes

Versions: 1

Compression:

Stored size: 743 Bytes

Contents

RSpec.configure do |config|
  
  config.before(:suite) do
    unless ['all', 'each', ''].include?(ENV['RSPEC_STACKPROF'].to_s)
      raise "ENV['RSPEC_STACKPROF'] should be blank, 'all' or 'each', but was '#{ENV['RSPEC_STACKPROF']}'"
    end

    if ENV['RSPEC_STACKPROF'] == 'all'
      StackProf.start RSpec::StackProf.options
    end
  end

  config.after(:suite) do
    if ENV['RSPEC_STACKPROF'] == 'all'
      StackProf.stop 
      StackProf.results
    end
  end

  config.around(:each) do |example|
    if ENV['RSPEC_STACKPROF'] == 'each'
      RSpec::StackProf.configuration.out_file = RSpec::StackProf::filename_for(example)
      StackProf.run(RSpec::StackProf.options) { example.call }
    else
      example.call
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspec-stackprof-0.1.0 lib/rspec/stackprof/rspec.rb