Skip to content

Commit 59d8b6e

Browse files
committed
test: verify Remove button is disabled for sole owner
Replace the test that clicked Remove on the sole owner (which now fails because the button is disabled). The new tests verify: - Button is disabled when only one confirmed owner exists - Button is enabled when multiple confirmed owners exist
1 parent a3c8c67 commit 59d8b6e

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

test/system/owner_test.rb

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,21 +104,22 @@ class OwnerTest < ApplicationSystemTestCase
104104
assert_equal [@other_user.email], last_email.to
105105
end
106106

107-
test "removing last owner shows error message" do
107+
test "remove button is disabled for sole owner" do
108108
visit_ownerships_page
109109

110110
within_element owner_row(@user) do
111-
accept_confirm do
112-
click_button "Remove"
113-
end
111+
assert_selector "input[type='submit'][value='Remove'][disabled]"
114112
end
113+
end
115114

116-
assert page.has_selector?("a[href='#{profile_path(@user.display_id)}']")
117-
assert page.has_selector? "#flash_alert", text: "Can't remove the only owner of the gem"
115+
test "remove button is enabled when multiple confirmed owners exist" do
116+
create(:ownership, user: @other_user, rubygem: @rubygem)
118117

119-
perform_enqueued_jobs only: ActionMailer::MailDeliveryJob
118+
visit_ownerships_page
120119

121-
assert_no_emails
120+
within_element owner_row(@user) do
121+
assert_selector "input[type='submit'][value='Remove']:not([disabled])"
122+
end
122123
end
123124

124125
test "verify using webauthn" do

0 commit comments

Comments
 (0)