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.
This commit is contained in:
Javi Martín
2023-10-13 00:23:46 +02:00
parent a8bd5eb192
commit 5f0a7f4bbc

View File

@@ -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