Skip to content

Commit

Permalink
Add spec/dependency for memory_profiler
Browse files Browse the repository at this point in the history
  • Loading branch information
braindeaf committed Dec 6, 2023
1 parent 6ddff76 commit 82bb4ef
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -8,6 +8,7 @@ gemspec
group :test do
gem 'codecov', require: false
gem 'stackprof', require: false
gem 'memory_profiler', require: false
end

group :development do
Expand Down
28 changes: 28 additions & 0 deletions spec/integration/mini_profiler_spec.rb
Expand Up @@ -141,6 +141,34 @@ def app
end
end

it 'works with memory_profiler' do
pid = fork do # Avoid polluting main process with stackprof
require 'memory_profiler'

# Should store flamegraph for ?pp=profile-memory
Rack::MiniProfiler.config.enable_advanced_debugging_tools = true
get '/html?pp=profile-memory'
expect(last_response).to be_ok
expect(last_response.body).to match(/allocated memory by gem/)
expect(last_response.body).to match(/allocated memory by file/)
expect(last_response.body).to match(/allocated memory by location/)
expect(last_response.body).to match(/allocated memory by class/)
expect(last_response.body).to match(/allocated objects by gem/)
expect(last_response.body).to match(/allocated objects by file/)
expect(last_response.body).to match(/allocated objects by location/)
expect(last_response.body).to match(/allocated objects by class/)
expect(last_response.body).to match(/retained objects by gem/)
expect(last_response.body).to match(/retained objects by file/)
expect(last_response.body).to match(/retained objects by location/)
expect(last_response.body).to match(/retained objects by class/)
expect(last_response.body).to match(/Allocated String Report/)
expect(last_response.body).to match(/Retained String Report/)
end

Process.wait(pid)
expect($?.exitstatus).to eq(0)
end

it 'works with async-flamegraph' do
pid = fork do # Avoid polluting main process with stackprof
require 'stackprof'
Expand Down

0 comments on commit 82bb4ef

Please sign in to comment.