Add consistency to back_links

In some cases (e.g. after editing or creating a resource
with errors) the default back_link did not redirect to the
expected page.

Now we force the back_links to the index pages, so we
always get the desired redirect.
This commit is contained in:
taitus
2022-09-14 11:38:01 +02:00
parent 2d353ba893
commit 86ff4eeff9
13 changed files with 21 additions and 10 deletions

View File

@@ -7,6 +7,8 @@ describe "Answers", :admin do
visit admin_question_path(question)
click_link "Add answer"
expect(page).to have_link "Go back", href: admin_question_path(question)
fill_in "Answer", with: "The answer is always 42"
fill_in_ckeditor "Description", with: "The Hitchhiker's Guide To The Universe"
@@ -39,6 +41,8 @@ describe "Answers", :admin do
visit admin_question_path(question)
within("tr", text: "Answer title") { click_link "Edit" }
expect(page).to have_link "Go back", href: admin_question_path(question)
fill_in "Answer", with: "New title"
click_button "Save"