Unify tests related with shows or hides max documents warning

This commit is contained in:
taitus
2025-05-16 10:36:12 +02:00
parent a4e7b70227
commit 64c1c59a7a

View File

@@ -69,30 +69,18 @@ describe "Nested documentable" do
expect(page).not_to have_link "Add new document"
end
scenario "Should not show max documents warning when no documents added" do
scenario "Shows or hides max documents warning depending on max documents limit" do
do_login_for(user, management: management_section?(path))
visit path
expect(page).not_to have_css ".max-documents-notice"
end
scenario "Should show max documents warning when max documents allowed limit is reached" do
do_login_for(user, management: management_section?(path))
visit path
expect(page).not_to have_content "Remove document"
documentable_attach_new_file(file_fixture("empty.pdf"))
expect(page).to have_css ".max-documents-notice"
expect(page).to have_content "Remove document"
end
scenario "Should hide max documents warning after any document removal" do
do_login_for(user, management: management_section?(path))
visit path
click_link "Add new document"
all("a", text: "Cancel").last.click
click_link "Remove document"
expect(page).not_to have_css ".max-documents-notice"
end