Commit Graph

14 Commits

Author SHA1 Message Date
taitus
12c1d77061 Extract management_budget_investment from shared nested documentable spec to system specs
Replaced 'login_as' with 'do_login_for' using 'management: management_section?' to
handle login requirements correctly for each context.

Also removed the now-unused 'documentable_fill_new_valid_budget_investment' helper
from common actions.

Note that it does not seem necessary to create an administrator with the user, as was
done in the original shared example. Also, as in the previous commit, it appears that
we do not need to set the user as the author when creating the documentable.

While reviewing this, we also noticed that the create(:administrator, user: user) call
was unnecessarily included in the nested_imageable system spec in commit cdfaec5217 when
the path is a management section. So we use this commit to remove the unnecessary condition.
2025-06-06 15:56:27 +02:00
taitus
fdee159185 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.
2024-11-26 18:10:28 +01:00
taitus
3fd2a1f498 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`.
2024-11-26 18:10:28 +01:00
taitus
08c4ecbed2 Remove unnecessary method 2024-11-26 18:10:28 +01:00
taitus
84bec1241f Remove redundant "loading-bar.errors"
In the imageable_attach_new_file method used in this tests the:
> expect(page).to have_css ".loading-bar.errors"
is already being checked.

Therefore, to leave only the line:
> imageable_attach_new_file(file_fixture("logo_header.png"), false)
in the test, since there is another test that verifies it,
I think we can remove the test altogether.
2024-11-26 18:10:28 +01:00
taitus
c80641e5f2 Regroup tests for edit path 2024-11-26 18:10:28 +01:00
taitus
e450186122 Regroup tests for link visibility and upload images 2024-11-26 18:10:28 +01:00
taitus
71e758f71c Remove redundant ".loading-bar.complete"
In the imageable_attach_new_file method used in these tests the:
> expect(page).to have_css ".loading-bar.complete"
is already being checked, so there is no need to verify it twice.
2024-11-26 18:10:28 +01:00
taitus
3877479b69 Extract proposal edit from shared nested imageable specs to system specs 2024-11-26 18:10:26 +01:00
taitus
cdfaec5217 Extract management budget investment from shared nested imageable specs to system specs 2024-11-26 17:58:10 +01:00
taitus
1cf85560dd Extract poll question option images from shared nested imageable specs to system specs
This is the only it_behaves_like "nested imageable" call where the has_many_images parameter is set to true.

Previously, the shared example skipped or altered expectations based on this parameter. Now, this behavior is
moved to the factory level (:future_poll_question_option).

Since this is an administrative section, a related administrator is created for the user.
2024-11-26 17:58:10 +01:00
taitus
2212a2a2f4 Extract budget investment from shared nested imageable specs to system specs 2024-11-26 17:58:10 +01:00
taitus
add50d68f6 Extract proposal new from shared nested imageable specs to system specs
Make `path`, `fill_resource_method_name`, `submit_button`, and
`imageable_success_notice` dynamic based on the factory.

Also adjusted the user. The proposals no longer require the user to be an
administrator but do require them to be a level 2 user.

Note that we are adding the Style/CaseLikeIf rubocop rule.
2024-11-26 17:57:01 +01:00
taitus
fb98cb61ac Extract budgets from shared nested imageable specs to system specs
Removed `imageable_path_arguments`, `has_many_images`, and `management` parameters
because they are not used by budgets.

Hardcoded `path`, `fill_resource_method_name`, `submit_button`, and
`imageable_success_notice`parameters for budgets. These remain fixed for now until dynamic
values are required in the next commits.
2024-11-20 16:27:53 +01:00