fix spec

fix spec

diff --git a/plugin.rb b/plugin.rb
index 5fe0a69..135c8a4 100644
--- a/plugin.rb
+++ b/plugin.rb
@@ -251,19 +251,19 @@ after_initialize do
     get '/upcoming-events' => 'upcoming_events#index'
   end
 
-  on(:post_destroyed) do |post|
+  DiscourseEvent.on(:post_destroyed) do |post|
     if SiteSetting.post_event_enabled && post.post_event
       post.post_event.update!(deleted_at: Time.now)
     end
   end
 
-  on(:post_recovered) do |post|
+  DiscourseEvent.on(:post_recovered) do |post|
     if SiteSetting.post_event_enabled && post.post_event
       post.post_event.update!(deleted_at: nil)
     end
   end
 
-  on(:post_edited) do |post, topic_changed|
+  DiscourseEvent.on(:post_edited) do |post, topic_changed|
     if SiteSetting.post_event_enabled && post.post_event && post.is_first_post? && post.topic && topic_changed && post.topic != Archetype.private_message
       time_range = extract_time_range(post.topic, post.user)
 
@@ -293,7 +293,7 @@ after_initialize do
     ).sniff
   end
 
-  on(:topic_created) do |topic, args, user|
+  DiscourseEvent.on(:topic_created) do |topic, args, user|
     if SiteSetting.post_event_enabled && topic.archetype != Archetype.private_message
       time_range = extract_time_range(topic, user)
 
diff --git a/spec/acceptance/post_spec.rb b/spec/acceptance/post_spec.rb
index 77a75e6..e3619cc 100644
--- a/spec/acceptance/post_spec.rb
+++ b/spec/acceptance/post_spec.rb
@@ -14,6 +14,7 @@ describe Post do
   before do
     freeze_time
     SiteSetting.queue_jobs = false
+    SiteSetting.post_event_enabled = true
   end
 
   context 'when a post with an event is destroyed' do
diff --git a/spec/acceptance/topic_spec.rb b/spec/acceptance/topic_spec.rb
index dd02162..07c02d6 100644
--- a/spec/acceptance/topic_spec.rb
+++ b/spec/acceptance/topic_spec.rb
@@ -8,6 +8,7 @@ describe Topic do
   before do
     freeze_time
     SiteSetting.queue_jobs = false
+    SiteSetting.post_event_enabled = true
   end
 
   fab!(:user) { Fabricate(:user) }
diff --git a/spec/requests/invitees_controller_spec.rb b/spec/requests/invitees_controller_spec.rb
index 82a0fa6..dbf8b4c 100644
--- a/spec/requests/invitees_controller_spec.rb
+++ b/spec/requests/invitees_controller_spec.rb
@@ -11,6 +11,7 @@ module DiscourseCalendar
 
     before do
       SiteSetting.queue_jobs = false
+      SiteSetting.post_event_enabled = true
       sign_in(user)
     end
 
diff --git a/spec/requests/post_events_controller_spec.rb b/spec/requests/post_events_controller_spec.rb
index 9726cf3..441317e 100644
--- a/spec/requests/post_events_controller_spec.rb
+++ b/spec/requests/post_events_controller_spec.rb
@@ -14,6 +14,7 @@ module DiscourseCalendar
     before do
       SiteSetting.queue_jobs = false
       SiteSetting.displayed_invitees_limit = 3
+      SiteSetting.post_event_enabled = true
     end
 
     context 'when a post exists' do

GitHub sha: 2bf615cf