Skip to content

A platform for community discussion. Free, open, simple.

709 B
Raw Blame
# frozen_string_literal: true

describe Topic do
  before do
    freeze_time
    Jobs.run_immediately!
    SiteSetting.discourse_events_enabled = true
    SiteSetting.discourse_post_event_enabled = true
  end

  let(:user) { Fabricate(:user, refresh_auto_groups: true) }

  context "when a topic is created" do
    context "with a date in title" do
      it "doesn’t create a post event" do
        post_with_date =
          PostCreator.create!(
            user,
            title: "Let’s buy a boat with me tomorrow",
            raw: "The boat market is quite active lately.",
          )

        expect(DiscourseEvents::Events::Event).to_not exist(id: post_with_date.id)
      end
    end
  end
end