Extract proposals from shared nested documentable to system specs

Removed the now-unused 'documentable_fill_new_valid_proposal' method
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.

Also removed the documentable_redirected_to_resource_show_or_navigate_to method,
which was only used for the :proposal factory but was not necessary.
- In the "Proposal new" case (this commit), after submitting the form we are
redirected to the "created" page, where the link "Not now, go to my proposal"
does not appear. This caused the method to always raise a
Capybara::ElementNotFound and return nil.

Instead, this "created" page already displays a preview of the proposal
and a link to publish it. Since we can verify that the proposal was created
successfully here, no redirection or click is needed.

- In the "Proposal edit" case (next commit), the user is redirected directly
to the proposal's "show" page after update, so again, the method is
unnecessary and has been removed.
This commit is contained in:
taitus
2025-05-14 17:43:51 +02:00
parent 12c1d77061
commit 979171ec45
4 changed files with 13 additions and 30 deletions

View File

@@ -210,9 +210,6 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
click_button submit_button
expect(page).to have_content documentable_success_notice
documentable_redirected_to_resource_show_or_navigate_to
expect(page).to have_content "Documents"
expect(page).to have_content "empty.pdf"
@@ -235,9 +232,6 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
click_button submit_button
expect(page).to have_content documentable_success_notice
documentable_redirected_to_resource_show_or_navigate_to
expect(page).to have_content "Documents (#{documentable.class.max_documents_allowed})"
end