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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user