Remove redirected_to_resource_show_or_navigate_to method

This method was removed as its logic was redundant or unnecessary:

- For "Proposal" new:
After creating a proposal, we are redirected to the "created" page, where the text
"Not now, go to my proposal" is not present, leading to a constant
`rescue Capybara::ElementNotFound`.

Instead, the "created" page shows a preview of how the proposal will look when
published and a link saying "No, I want to publish the proposal".  Since the click's
purpose was to navigate to the proposal's "show" page, and this can already be
verified on the "created" page, no additional handling is needed for this case.

- For "Proposal" edit:
After updating the proposal, we are directly redirected to the proposal's "show" page,
so no click_link logic is necessary here either.

- For "Budget":
The redirection is now handled directly with:
  `visit edit_admin_budget_path(imageable) if factory == :budget`.
This commit is contained in:
taitus
2024-11-21 15:06:27 +01:00
parent 08c4ecbed2
commit 3fd2a1f498

View File

@@ -163,7 +163,7 @@ describe "Nested imageable" do
expect(page).to have_content notice_text expect(page).to have_content notice_text
redirected_to_resource_show_or_navigate_to(imageable) visit edit_admin_budget_path(imageable) if factory == :budget
expect(page).to have_css "figure img" expect(page).to have_css "figure img"
expect(page).to have_css "figure figcaption" if show_caption_for?(factory) expect(page).to have_css "figure figcaption" if show_caption_for?(factory)
@@ -208,15 +208,6 @@ describe "Nested imageable" do
factory != :budget factory != :budget
end end
def redirected_to_resource_show_or_navigate_to(imageable)
case imageable.class.to_s
when "Budget"
visit edit_admin_budget_path(Budget.last)
when "Proposal"
click_link "Not now, go to my proposal" rescue Capybara::ElementNotFound
end
end
def fill_in_required_fields def fill_in_required_fields
return if edit_path? return if edit_path?