diff --git a/spec/acceptance/activesupport_instrumentation_spec.rb b/spec/acceptance/activesupport_instrumentation_spec.rb index edc21537..96f79d86 100644 --- a/spec/acceptance/activesupport_instrumentation_spec.rb +++ b/spec/acceptance/activesupport_instrumentation_spec.rb @@ -97,13 +97,15 @@ def subscribed(callback, *args) end it "tracks proper time of compiling the factory" do - time_to_execute = 0 - callback = ->(_name, start, finish, _id, _payload) { time_to_execute = finish - start } + time_to_execute = {user: 0} + callback = ->(_name, start, finish, _id, payload) { + time_to_execute[payload[:name]] = (finish - start) + } ActiveSupport::Notifications.subscribed(callback, "factory_bot.compile_factory") do FactoryBot.build(:user) end - expect(time_to_execute).to be > 0 + expect(time_to_execute[:user]).to be > 0 end it "builds the correct payload" do