mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
FIX: Possible 500 error if category saved incorrectly
This commit is contained in:
@ -192,26 +192,34 @@ describe ListController do
|
||||
end
|
||||
|
||||
describe "category default views" do
|
||||
it "top default view" do
|
||||
it "has a top default view" do
|
||||
category.update_attributes!(default_view: 'top', default_top_period: 'monthly')
|
||||
described_class.expects(:best_period_with_topics_for).with(anything, category.id, :monthly).returns(:monthly)
|
||||
xhr :get, :category_default, category: category.slug
|
||||
expect(response).to be_success
|
||||
end
|
||||
|
||||
it "default view is nil" do
|
||||
it "has a default view of nil" do
|
||||
category.update_attributes!(default_view: nil)
|
||||
described_class.expects(:best_period_for).never
|
||||
xhr :get, :category_default, category: category.slug
|
||||
expect(response).to be_success
|
||||
end
|
||||
|
||||
it "default view is latest" do
|
||||
it "has a default view of ''" do
|
||||
category.update_attributes!(default_view: '')
|
||||
described_class.expects(:best_period_for).never
|
||||
xhr :get, :category_default, category: category.slug
|
||||
expect(response).to be_success
|
||||
end
|
||||
|
||||
it "has a default view of latest" do
|
||||
category.update_attributes!(default_view: 'latest')
|
||||
described_class.expects(:best_period_for).never
|
||||
xhr :get, :category_default, category: category.slug
|
||||
expect(response).to be_success
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user