Skip to content

Commit eda84cf

Browse files
authored
Use rspec hook filters to target flamegraph logic
The current RSpec hook always run and decides whether or not to flamegraph _inside_ the hook. That means it'll always show up on backtraces and does work. This change makes it so that it only runs when the metadata is set.
1 parent fe7e630 commit eda84cf

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

lib/singed/rspec.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
require 'singed'
22

33
RSpec.configure do |config|
4-
config.around do |example|
5-
if example.metadata[:flamegraph]
6-
flamegraph { example.run }
7-
else
8-
example.run
9-
end
4+
config.around(flamegraph: true) do |example|
5+
flamegraph { example.run }
106
end
117
end

0 commit comments

Comments
 (0)