Skip to content

Commit a9e35d5

Browse files
authored
Merge pull request #1225 from Crown-Commercial-Service/feature/nrmi-167-remove-activate-action-for-archived-agreements-on-supplier-page
Feature/nrmi 167 remove activate action for archived agreements on supplier page
2 parents bb91d17 + 2991066 commit a9e35d5

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

app/views/admin/suppliers/_show_frameworks.html.haml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
%td.govuk-table__cell
1616
- if agreement.active?
1717
= link_to 'Deactivate', admin_supplier_agreement_confirm_deactivation_path(@supplier, agreement)
18-
- else
18+
- if !agreement.active? && !framework.archived?
1919
= link_to 'Activate', admin_supplier_agreement_confirm_activation_path(@supplier, agreement)
2020
%nav.pagination.ccs-pagination{"aria-label" => "Pagination", :role => "navigation"}
2121
#framework_pagination_summary.ccs-pagination__summary= page_entries_info @agreements, entry_name: "agreement"

spec/features/view_supplier_details_spec.rb

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
RSpec.feature 'Viewing a supplier' do
44
let!(:supplier) { FactoryBot.create(:supplier, name: 'Test Supplier Ltd') }
55
let!(:framework) { FactoryBot.create(:framework, name: 'Test Framework', short_name: 'RM0000') }
6+
let!(:archived_framework) { FactoryBot.create(:framework, name: 'Archived Framework', short_name: 'RM0001') }
67
let!(:agreement) { FactoryBot.create(:agreement, supplier: supplier, framework: framework) }
8+
let!(:inactive_agreement) { FactoryBot.create(:agreement, supplier: supplier, framework: archived_framework) }
79
let!(:user) { FactoryBot.create(:user, name: 'User One', email: 'email_one@ccs.co.uk', suppliers: [supplier]) }
810

911
before { sign_in_as_admin }
@@ -12,7 +14,14 @@
1214
visit admin_supplier_path(supplier)
1315
expect(page).to have_content 'Test Supplier Ltd'
1416
expect(page).to have_content 'RM0000 Test Framework'
15-
expect(page).to have_content 'Displaying 1 agreement'
17+
expect(page).to have_content 'Displaying all 2 agreements'
18+
end
19+
20+
scenario 'shows activate/deactivate links based on agreement and framework status' do
21+
visit admin_supplier_path(supplier)
22+
expect(page).to have_link 'Deactivate',
23+
href: admin_supplier_agreement_confirm_deactivation_path(supplier, agreement)
24+
expect(page).not_to have_link 'Activate'
1625
end
1726

1827
scenario 'shows paginated list of the supplier’s tasks' do
@@ -73,6 +82,6 @@
7382
click_link('Next »', match: :first)
7483
expect(page).to have_content 'Displaying task 13 - 13 of 13 in total'
7584
expect(page).to have_content 'Displaying users 1 - 12 of 13 in total'
76-
expect(page).to have_content 'Displaying 1 agreement'
85+
expect(page).to have_content 'Displaying all 2 agreements'
7786
end
7887
end

0 commit comments

Comments
 (0)