From 069ee84371a82952ca6531f9ab60038e2e996d71 Mon Sep 17 00:00:00 2001 From: Aaryanpal Date: Sat, 14 Sep 2024 06:26:55 +0530 Subject: [PATCH] Resolve Comments --- app/controllers/partner_groups_controller.rb | 4 ++-- app/views/partners/_partner_groups_table.html.erb | 2 +- spec/system/partner_system_spec.rb | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/partner_groups_controller.rb b/app/controllers/partner_groups_controller.rb index 8259ad5f7f..86d0a302e8 100644 --- a/app/controllers/partner_groups_controller.rb +++ b/app/controllers/partner_groups_controller.rb @@ -1,5 +1,5 @@ class PartnerGroupsController < ApplicationController - before_action :set_partner_groups, only: %i[edit destroy] + before_action :set_partner_group, only: %i[edit destroy] def new @partner_group = current_organization.partner_groups.new @@ -41,7 +41,7 @@ def destroy private - def set_partner_groups + def set_partner_group @partner_group = current_organization.partner_groups.find(params[:id]) end diff --git a/app/views/partners/_partner_groups_table.html.erb b/app/views/partners/_partner_groups_table.html.erb index c59bbb297b..94778851c3 100644 --- a/app/views/partners/_partner_groups_table.html.erb +++ b/app/views/partners/_partner_groups_table.html.erb @@ -54,7 +54,7 @@ <%= edit_button_to edit_partner_group_path(pg) %> - <%= delete_button_to(partner_group_path(pg),{confirm: confirm_delete_msg(pg.name)}) unless pg.partners.any? %> + <%= delete_button_to(partner_group_path(pg),{confirm: confirm_delete_msg(pg.name)}) if pg.partners.none? %> <% end %> diff --git a/spec/system/partner_system_spec.rb b/spec/system/partner_system_spec.rb index 66b1d1a338..2bb5463ee8 100644 --- a/spec/system/partner_system_spec.rb +++ b/spec/system/partner_system_spec.rb @@ -540,8 +540,8 @@ it 'should not display the delete link' do visit partners_path click_on 'Groups' - expect(page).to have_content(first_partner_group.name) - expect(page).to have_content(first_partner.name) + expect(page).to have_content('Group 2') + expect(page).to have_content('Leslie Sue, the 1') expect(page).not_to have_link('Delete') end end @@ -554,7 +554,7 @@ it 'should display the delete link and allow deletion' do visit partners_path click_on 'Groups' - expect(page).to have_content(second_partner_group.name) + expect(page).to have_content('Group 1') expect(page).to have_link('Delete') expect do accept_confirm do