Disable Unit destuction for base units with subunits

Closes #40
This commit is contained in:
2024-12-28 23:57:47 +01:00
parent bd40727231
commit 8552571526
6 changed files with 15 additions and 8 deletions

View File

@@ -162,6 +162,13 @@ class UnitsTest < ApplicationSystemTestCase
assert_selector 'tbody > tr:has(input, textarea)'
end
#test "destroy" do
#end
test "destroy" do
link = all(:link_or_button, exact_text: t('units.unit.destroy')).sample
label = link.ancestor('tr').first(:link)[:text]
assert_difference ->{ @user.units.count }, -1 do
link.click
end
assert_selector 'tbody tr', count: [@user.units.count, 1].max
assert_selector '.flash.notice', text: t('units.destroy.success', unit: label)
end
end