mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 22:26:26 +08:00
19 lines
400 B
Ruby
19 lines
400 B
Ruby
module DiscourseEvent::TestHelper
|
|
def trigger(event_name, *params)
|
|
super(event_name, *params)
|
|
|
|
if @events_trigger
|
|
@events_trigger << { event_name: event_name, params: params }
|
|
end
|
|
end
|
|
|
|
def track_events
|
|
@events_trigger = events_trigger = []
|
|
yield
|
|
@events_trigger = nil
|
|
events_trigger
|
|
end
|
|
end
|
|
|
|
DiscourseEvent.singleton_class.prepend DiscourseEvent::TestHelper
|