From 368cf47adf905180d2abd98be129a0b5ff298122 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 12 Mar 2025 21:30:02 +0100 Subject: [PATCH] Group tests to delete a document together This way the tests are slightly faster, and we avoid a possible flaky spec since in one test we were checking that a certain text was not present, which didn't guarantee that the request to delete the document had finished. --- spec/shared/system/documentable.rb | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/spec/shared/system/documentable.rb b/spec/shared/system/documentable.rb index 3f7177573..43277e9e6 100644 --- a/spec/shared/system/documentable.rb +++ b/spec/shared/system/documentable.rb @@ -97,28 +97,7 @@ shared_examples "documentable" do |documentable_factory_name, documentable_path, end expect(page).to have_content "Document was deleted successfully." - end - - scenario "Should hide documents tab if there is no documents" do - login_as documentable.author - - visit send(documentable_path, arguments) - - within "#document_#{document.id}" do - accept_confirm { click_button "Delete document" } - end - expect(page).not_to have_content "Documents (0)" - end - - scenario "Should redirect to documentable path after successful deletion" do - login_as documentable.author - - visit send(documentable_path, arguments) - - within "#document_#{document.id}" do - accept_confirm { click_button "Delete document" } - end within "##{ActionView::RecordIdentifier.dom_id(documentable)}" do expect(page).to have_css "h1", text: documentable.title