SPEC: add spec for event_destroyer

SPEC: add spec for event_destroyer

diff --git a/spec/lib/event_destroyer_spec.rb b/spec/lib/event_destroyer_spec.rb
new file mode 100644
index 0000000..d37df4e
--- /dev/null
+++ b/spec/lib/event_destroyer_spec.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+require "rails_helper"
+
+describe DiscourseCalendar::EventDestroyer do
+
+  before { SiteSetting.calendar_enabled = true }
+
+  it "removes event when a post is deleted" do
+    op = create_post(raw: "[calendar]\n[/calendar]")
+    post = create_post(raw: %{Some Event [date="2019-09-10"]}, topic: op.topic)
+    CookedPostProcessor.new(post).post_process
+
+    op.reload
+    expect(op.calendar_details[post.post_number.to_s]).to be_present
+
+    PostDestroyer.new(Discourse.system_user, post).destroy
+
+    op.reload
+    expect(op.calendar_details[post.post_number.to_s]).to_not be_present
+  end
+end

GitHub sha: 8bbf51a1