Fix deleting searched managers/moderators/admins
We were deleting managers, moderators and administrators based on their user ID, instead of their manager/moderator/administrator ID.
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
<td class="text-right">
|
||||
<% if user.administrator? && user.administrator.persisted? %>
|
||||
<%= link_to t("admin.administrators.administrator.delete"),
|
||||
admin_administrator_path(user),
|
||||
admin_administrator_path(user.administrator),
|
||||
method: :delete,
|
||||
class: "button hollow alert expanded" %>
|
||||
<% else %>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<td>
|
||||
<% if user.manager? && user.manager.persisted? %>
|
||||
<%= link_to t("admin.managers.manager.delete"),
|
||||
admin_manager_path(user),
|
||||
admin_manager_path(user.manager),
|
||||
method: :delete,
|
||||
class: "button hollow alert expanded" %>
|
||||
<% else %>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<td>
|
||||
<% if user.moderator? && user.moderator.persisted? %>
|
||||
<%= link_to t("admin.moderators.moderator.delete"),
|
||||
admin_moderator_path(user),
|
||||
admin_moderator_path(user.moderator),
|
||||
method: :delete,
|
||||
class: "button hollow alert expanded" %>
|
||||
<% else %>
|
||||
|
||||
@@ -98,6 +98,16 @@ describe "Admin administrators" do
|
||||
expect(page).to have_content(administrator2.email)
|
||||
expect(page).not_to have_content(administrator1.email)
|
||||
end
|
||||
|
||||
scenario "Delete after searching" do
|
||||
fill_in "Search user by name or email", with: administrator2.email
|
||||
click_button "Search"
|
||||
|
||||
click_link "Delete"
|
||||
|
||||
expect(page).to have_content(administrator1.email)
|
||||
expect(page).not_to have_content(administrator2.email)
|
||||
end
|
||||
end
|
||||
|
||||
context "Edit" do
|
||||
|
||||
@@ -80,5 +80,15 @@ describe "Admin managers" do
|
||||
expect(page).to have_content(manager2.email)
|
||||
expect(page).not_to have_content(manager1.email)
|
||||
end
|
||||
|
||||
scenario "Delete after searching" do
|
||||
fill_in "Search user by name or email", with: manager2.email
|
||||
click_button "Search"
|
||||
|
||||
click_link "Delete"
|
||||
|
||||
expect(page).to have_content(manager1.email)
|
||||
expect(page).not_to have_content(manager2.email)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -80,5 +80,15 @@ describe "Admin moderators" do
|
||||
expect(page).to have_content(moderator2.email)
|
||||
expect(page).not_to have_content(moderator1.email)
|
||||
end
|
||||
|
||||
scenario "Delete after searching" do
|
||||
fill_in "Search user by name or email", with: moderator2.email
|
||||
click_button "Search"
|
||||
|
||||
click_link "Delete"
|
||||
|
||||
expect(page).to have_content(moderator1.email)
|
||||
expect(page).not_to have_content(moderator2.email)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user