Fix links to uncategorized when SiteSetting.uncategorized_name is set

This commit is contained in:
Neil Lalonde 2013-06-27 16:16:06 -04:00
parent 5d6ad8f39c
commit 1355c1e3b0
2 changed files with 17 additions and 5 deletions

View File

@ -83,7 +83,9 @@ class ListController < ApplicationController
end
def request_is_for_uncategorized?
params[:category] == Slug.for(SiteSetting.uncategorized_name) || params[:category] == SiteSetting.uncategorized_name
params[:category] == Slug.for(SiteSetting.uncategorized_name) ||
params[:category] == SiteSetting.uncategorized_name ||
params[:category] == 'uncategorized'
end
def build_topic_list_options

View File

@ -85,10 +85,20 @@ describe ListController do
response.should be_success
end
it "responds with success when SiteSetting.uncategorized_name is non standard" do
SiteSetting.uncategorized_name = "testing"
xhr :get, :category, category: SiteSetting.uncategorized_name
response.should be_success
context 'SiteSetting.uncategorized_name is non standard' do
before do
SiteSetting.stubs(:uncategorized_name).returns('testing')
end
it "responds with success given SiteSetting.uncategorized_name" do
xhr :get, :category, category: SiteSetting.uncategorized_name
response.should be_success
end
it 'responds with success given "uncategorized"' do
xhr :get, :category, category: 'uncategorized'
response.should be_success
end
end
end