test: assert the choices read by its labels, not respond_to
The store test I just added refuted a choice responding to :members,
but every Ruby Data instance answers #members with its member names,
so the check could never hold and it failed the suite. What it meant
to prove — that a choice is the group row, membership and all left
unread — is not something respond_to can see. The label-and-name map
already proves the read returns id, name and label; a member added to
one of the groups shows a choice reads the same whether anyone is in
it or not.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KrREeoPLXx1qsYYq7qkL8h
diff --git a/test/pro_tacts/test_store.rb b/test/pro_tacts/test_store.rb
index 6702603..b2215ef 100644
--- a/test/pro_tacts/test_store.rb
+++ b/test/pro_tacts/test_store.rb
@@ -1346,18 +1346,17 @@ class StoreTest < Minitest::Test
# The pickers' read: id, name and the same coalesced label a tag
# shows, and nothing about who is in a group — a nameless group is
- # its id here as everywhere.
+ # its id here as everywhere. A choice a member joins reads the same
+ # as one nobody is in, the membership being no part of what a picker
+ # shows.
def test_group_choices_carry_the_label_without_the_membership
- with_store do |store|
+ with_store({"aiden" => UUID_CARD}) do |store|
named = store.create_group(name: "Household")
nameless = store.create_group
-
- choices = store.group_choices
+ store.add_member(named, "aiden")
assert_equal({named => ["Household", "Household"], nameless => [nil, nameless]}.sort.to_h,
- choices.to_h { [it.id, [it.name, it.label]] })
- refute choices.first.respond_to?(:members),
- "a choice is the group row alone, with no membership read behind it"
+ store.group_choices.to_h { [it.id, [it.name, it.label]] })
end
end