From 1355c1e3b0e95fae988d246933465639ad83e0fa Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Thu, 27 Jun 2013 16:16:06 -0400 Subject: [PATCH] Fix links to uncategorized when SiteSetting.uncategorized_name is set --- app/controllers/list_controller.rb | 4 +++- spec/controllers/list_controller_spec.rb | 18 ++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/app/controllers/list_controller.rb b/app/controllers/list_controller.rb index c03b760e0..2f7740d1c 100644 --- a/app/controllers/list_controller.rb +++ b/app/controllers/list_controller.rb @@ -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 diff --git a/spec/controllers/list_controller_spec.rb b/spec/controllers/list_controller_spec.rb index c8a5a74c4..1f24d374d 100644 --- a/spec/controllers/list_controller_spec.rb +++ b/spec/controllers/list_controller_spec.rb @@ -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