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

@@ -50,8 +50,9 @@ describe "Admin poll questions", :admin do
visit admin_poll_path(poll)
click_link "Edit answers"
expect(page).to have_content(question.title)
expect(page).to have_content(question.author.name)
expect(page).to have_link "Go back", href: admin_poll_path(poll)
expect(page).to have_content question.title
expect(page).to have_content question.author.name
end
scenario "Create" do
@@ -123,6 +124,7 @@ describe "Admin poll questions", :admin do
click_link "Edit"
end
expect(page).to have_link "Go back", href: admin_poll_path(poll)
old_title = question1.title
new_title = "Potatoes are great and everyone should have one"
fill_in "Question", with: new_title