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.
This commit is contained in:
taitus
2025-05-14 16:16:05 +02:00
parent b7adf760f6
commit 12c1d77061
4 changed files with 29 additions and 37 deletions

View File

@@ -52,7 +52,7 @@ describe "Nested imageable" do
context "New and edit path" do
before do
create(:administrator, user: user) if admin_section? || management_section?
create(:administrator, user: user) if admin_section?
imageable.update!(author: user) if edit_path?
do_login_for(user, management: management_section?)
visit path