From fdee1591855bb42a367a672d26c558752ef19194 Mon Sep 17 00:00:00 2001 From: taitus Date: Thu, 21 Nov 2024 15:18:57 +0100 Subject: [PATCH] Remove show_caption_for? method The `show_caption_for?` method was used to determine whether to check for the presence of a `figcaption` element, but its only purpose was to skip the check when the factory was `:budget. The reason we skip the `figcaption` check for `:budget` is that it is the only case where the test is verifying the form's edit page, where displaying a `figcaption` does not make sense. --- spec/system/nested_imageable_spec.rb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/spec/system/nested_imageable_spec.rb b/spec/system/nested_imageable_spec.rb index 202f630cd..26038a0d0 100644 --- a/spec/system/nested_imageable_spec.rb +++ b/spec/system/nested_imageable_spec.rb @@ -163,10 +163,12 @@ describe "Nested imageable" do expect(page).to have_content notice_text - visit edit_admin_budget_path(imageable) if factory == :budget - + if factory == :budget + click_link "Go back to edit budget" + else + expect(page).to have_css "figure figcaption" + end expect(page).to have_css "figure img" - expect(page).to have_css "figure figcaption" if show_caption_for?(factory) end scenario "Different URLs for different images" do @@ -204,10 +206,6 @@ describe "Nested imageable" do end end - def show_caption_for?(factory) - factory != :budget - end - def fill_in_required_fields return if edit_path?