Skip to content

Commit

Permalink
Fixes UserConfigurationTest failures
Browse files Browse the repository at this point in the history
  • Loading branch information
HazelGrant committed Apr 9, 2024
1 parent 27c9a51 commit ec8f58d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apps/dashboard/app/models/user_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions apps/dashboard/test/models/user_configuration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit ec8f58d

Please sign in to comment.