discourse/spec/tasks/topics_spec.rb
Alan Guo Xiang Tan 6e1aeb1f50
DEV: Fix constant redefinition warnings when running specs (#29837)
Don't load rake files over and over again when running specs.
2024-11-20 15:17:36 +11:00

28 lines
661 B
Ruby

# frozen_string_literal: true
RSpec.describe "Post rake tasks" do
fab!(:post) { Fabricate(:post, raw: "The quick brown fox jumps over the lazy dog") }
let(:topic) { post.topic }
let(:category) { topic.category }
before { STDOUT.stubs(:write) }
describe "topics:apply_autoclose" do
it "should close topics silently" do
category.auto_close_hours = 1
category.save!
original_bumped_at = topic.bumped_at
freeze_time 2.hours.from_now
invoke_rake_task("topics:apply_autoclose")
topic.reload
expect(topic.closed).to eq(true)
expect(topic.bumped_at).to eq_time(original_bumped_at)
end
end
end