FIX: Category description topics shouldn't auto-close

This commit is contained in:
Neil Lalonde
2013-12-04 10:31:25 -05:00
parent df7b24b14a
commit abed146cc7
4 changed files with 23 additions and 1 deletions
+5
View File
@@ -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
+16
View File
@@ -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) }