From 5f0a7f4bbc42b82c7afb7450db5fa2fb2f181571 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 13 Oct 2023 00:23:46 +0200 Subject: [PATCH] Group show document tests together While in unit tests it's great to have different tests for different expectations, system tests are slow, and so it's better to have just one test for all the expectations related to the same actions. --- spec/shared/system/documentable.rb | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/spec/shared/system/documentable.rb b/spec/shared/system/documentable.rb index 296da2bda..83b2624b7 100644 --- a/spec/shared/system/documentable.rb +++ b/spec/shared/system/documentable.rb @@ -11,22 +11,12 @@ shared_examples "documentable" do |documentable_factory_name, documentable_path, end context "Show documents" do - scenario "Download action should be able to anyone" do + scenario "Download action should be availabe to anyone and open in a new window" do visit send(documentable_path, arguments) - expect(page).to have_link("Download file") - end - - scenario "Download file link should have blank target attribute" do - visit send(documentable_path, arguments) - - expect(page).to have_selector("a[target=_blank]", text: "Download file") - end - - scenario "Download file links should have rel attribute setted to no follow" do - visit send(documentable_path, arguments) - - expect(page).to have_selector("a[rel=nofollow]", text: "Download file") + expect(page).to have_link "Download file" + expect(page).to have_selector "a[target=_blank]", text: "Download file" + expect(page).to have_selector "a[rel=nofollow]", text: "Download file" end describe "Destroy action" do