Files
clinch/test/helpers/oidc_helper_test.rb
Dan MilneandClaude Opus 4.8 6c4be7199c Extract OidcScopes::SUPPORTED as the shared scope list
The supported-scope list lived on OidcController, so the device authorization
controller (and a test) had to reach across into OidcController::SUPPORTED_SCOPES.
Move it to a shared OidcScopes::SUPPORTED module — one source of truth for the
OIDC controller, the device flow, and consent handling — and update every
reference. No behavior change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016Q4ATZHoMCWqvSpE2yYoie
2026-07-19 14:42:39 +10:00

25 lines
1.2 KiB
Ruby

require "test_helper"
class OidcHelperTest < ActionView::TestCase
test "scope_description returns a human-readable label for each supported scope" do
user = User.new(email_address: "person@example.com")
assert_equal "Verify your identity", scope_description("openid", user: user)
assert_equal "Access your email address (person@example.com)", scope_description("email", user: user)
assert_equal "Access your profile information", scope_description("profile", user: user)
assert_equal "Access your group memberships", scope_description("groups", user: user)
assert_equal "Stay signed in (refresh access)", scope_description("offline_access", user: user)
end
test "scope_description covers every SUPPORTED_SCOPE (so the consent screens can't silently drop one)" do
user = User.new(email_address: "person@example.com")
OidcScopes::SUPPORTED.each do |scope|
assert_not_equal scope, scope_description(scope, user: user),
"#{scope} has no description and would render as its raw name"
end
end
test "scope_description falls back to the raw scope name for unknown scopes" do
assert_equal "somethingelse", scope_description("somethingelse", user: User.new)
end
end