mirror of
https://github.com/discourse/discourse.git
synced 2026-08-26 21:27:16 -05:00
FIX: Category description topics shouldn't auto-close
This commit is contained in:
@@ -210,6 +210,11 @@ describe Category do
|
||||
@category.topic_url.should be_present
|
||||
end
|
||||
|
||||
it "should not set its description topic to auto-close" do
|
||||
category = Fabricate(:category, name: 'Closing Topics', auto_close_days: 1)
|
||||
category.topic.auto_close_at.should be_nil
|
||||
end
|
||||
|
||||
describe "creating a new category with the same slug" do
|
||||
it "should have a blank slug" do
|
||||
Fabricate(:category, name: "Amazing Categóry").slug.should be_blank
|
||||
|
||||
@@ -1067,6 +1067,22 @@ describe Topic do
|
||||
end
|
||||
end
|
||||
|
||||
describe "auto_close_days=" do
|
||||
subject(:topic) { Fabricate.build(:topic) }
|
||||
|
||||
it 'can take a number' do
|
||||
Timecop.freeze(Time.zone.now) do
|
||||
topic.auto_close_days = 2
|
||||
topic.auto_close_at.should be_within_one_second_of(2.days.from_now)
|
||||
end
|
||||
end
|
||||
|
||||
it 'can take nil' do
|
||||
topic.auto_close_days = nil
|
||||
topic.auto_close_at.should be_nil
|
||||
end
|
||||
end
|
||||
|
||||
describe 'set_auto_close' do
|
||||
let(:topic) { Fabricate.build(:topic) }
|
||||
let(:closing_topic) { Fabricate.build(:topic, auto_close_days: 5) }
|
||||
|
||||
Reference in New Issue
Block a user