Store when a topic was first set to auto-close and report that amount of time when it closes. And do some refactoring.

This commit is contained in:
Neil Lalonde
2013-06-06 17:04:10 -04:00
parent b758427572
commit a151bfc7ec
7 changed files with 119 additions and 22 deletions

View File

@ -612,17 +612,12 @@ describe TopicsController do
end
it "can set a topic's auto close time" do
Topic.any_instance.expects(:auto_close_days=).with { |arg| arg.to_i == 3 }
Topic.any_instance.expects(:set_auto_close).with("3", @admin)
xhr :put, :autoclose, topic_id: @topic.id, auto_close_days: 3
end
it "can remove a topic's auto close time" do
Topic.any_instance.expects(:auto_close_days=).with(nil)
xhr :put, :autoclose, topic_id: @topic.id, auto_close_days: nil
end
it "sets the topic closer to the current user" do
Topic.any_instance.expects(:auto_close_user=).with(@admin)
Topic.any_instance.expects(:set_auto_close).with(nil, anything)
xhr :put, :autoclose, topic_id: @topic.id, auto_close_days: nil
end
end