|
3 | 3 | RSpec.feature 'Viewing a supplier' do |
4 | 4 | let!(:supplier) { FactoryBot.create(:supplier, name: 'Test Supplier Ltd') } |
5 | 5 | let!(:framework) { FactoryBot.create(:framework, name: 'Test Framework', short_name: 'RM0000') } |
| 6 | + let!(:archived_framework) { FactoryBot.create(:framework, name: 'Archived Framework', short_name: 'RM0001') } |
6 | 7 | let!(:agreement) { FactoryBot.create(:agreement, supplier: supplier, framework: framework) } |
| 8 | + let!(:inactive_agreement) { FactoryBot.create(:agreement, supplier: supplier, framework: archived_framework) } |
7 | 9 | let!(:user) { FactoryBot.create(:user, name: 'User One', email: 'email_one@ccs.co.uk', suppliers: [supplier]) } |
8 | 10 |
|
9 | 11 | before { sign_in_as_admin } |
|
12 | 14 | visit admin_supplier_path(supplier) |
13 | 15 | expect(page).to have_content 'Test Supplier Ltd' |
14 | 16 | 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' |
16 | 25 | end |
17 | 26 |
|
18 | 27 | scenario 'shows paginated list of the supplier’s tasks' do |
|
73 | 82 | click_link('Next »', match: :first) |
74 | 83 | expect(page).to have_content 'Displaying task 13 - 13 of 13 in total' |
75 | 84 | 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' |
77 | 86 | end |
78 | 87 | end |
0 commit comments