diff --git a/apps/dashboard/app/models/user_configuration.rb b/apps/dashboard/app/models/user_configuration.rb index 565ebb4b40..1fe33ea7d6 100644 --- a/apps/dashboard/app/models/user_configuration.rb +++ b/apps/dashboard/app/models/user_configuration.rb @@ -125,7 +125,7 @@ def announcement_path DEFAULT_NAV_CATEGORIES = ["Apps", "Files", "Jobs", "Clusters", "Interactive Apps"].freeze def filter_nav_categories? - fetch(:nav_categories, nil) + !!fetch(:nav_categories, nil) end def nav_categories diff --git a/apps/dashboard/test/models/user_configuration_test.rb b/apps/dashboard/test/models/user_configuration_test.rb index 89f3b67ca6..d5308034f1 100644 --- a/apps/dashboard/test/models/user_configuration_test.rb +++ b/apps/dashboard/test/models/user_configuration_test.rb @@ -177,12 +177,11 @@ def teardown assert_equal true, UserConfiguration.new.filter_nav_categories? end - test "filter_nav_categories? should return default value NavConfig.categories_whitelist? when categories is not set in config" do + test "filter_nav_categories? should return false when nav_categories is nil" do Configuration.stubs(:config).returns({}) - NavConfig.stubs(:categories_whitelist?).returns(false) assert_equal false, UserConfiguration.new.filter_nav_categories? - NavConfig.stubs(:categories_whitelist?).returns(true) + Configuration.stubs(:config).returns({nav_categories: []}) assert_equal true, UserConfiguration.new.filter_nav_categories? end