class FactoryTrace::Tracker
Attributes
storage[R]
Public Class Methods
new()
click to toggle source
# File lib/factory_trace/tracker.rb, line 5 def initialize @storage = {} end
Public Instance Methods
track!()
click to toggle source
# File lib/factory_trace/tracker.rb, line 9 def track! ActiveSupport::Notifications.subscribe('factory_bot.run_factory') do |_name, _start, _finish, _id, payload| name = payload[:name].to_s traits = payload[:traits].map(&:to_s) storage[name] ||= Set.new storage[name] |= traits end end