|
| 1 | +# frozen_string_literal: true |
| 2 | + |
| 3 | +Given 'the Digital Object is not suppressed' do |
| 4 | + expect(page).to have_css('button', text: 'Suppress') |
| 5 | +end |
| 6 | + |
| 7 | +Given 'the Digital Object is suppressed' do |
| 8 | + expect(page).to have_css('button', text: 'Suppress') |
| 9 | + |
| 10 | + click_on 'Suppress' |
| 11 | + within '.modal-content' do |
| 12 | + click_on 'Suppress' |
| 13 | + end |
| 14 | + |
| 15 | + expect(current_url).to include "digital_objects/#{@digital_object_id}" |
| 16 | + expect(page).to have_text "Digital Object Digital Object Title #{@uuid} suppressed" |
| 17 | + expect(page).to have_text 'Digital Object is suppressed and cannot be edited' |
| 18 | +end |
| 19 | + |
| 20 | +Then 'the Digital Object now is suppressed' do |
| 21 | + expect(current_url).to include "digital_objects/#{@digital_object_id}" |
| 22 | + expect(page).to have_text "Digital Object Digital Object Title #{@uuid} suppressed" |
| 23 | + expect(page).to have_text 'Digital Object is suppressed and cannot be edited' |
| 24 | +end |
| 25 | + |
| 26 | +Then 'the Digital Object now is not suppressed' do |
| 27 | + visit "#{STAFF_URL}/digital_objects/#{@digital_object_id}/edit" |
| 28 | + |
| 29 | + wait_for_ajax |
| 30 | + |
| 31 | + expect(current_url).to include "/digital_objects/#{@digital_object_id}/edit" |
| 32 | + |
| 33 | + expect(page).to have_css('button', text: 'Suppress') |
| 34 | +end |
| 35 | + |
| 36 | +Then 'the Digital Object cannot be accessed by archivists' do |
| 37 | + visit "#{STAFF_URL}/logout" |
| 38 | + |
| 39 | + login_archivist |
| 40 | + |
| 41 | + visit "#{STAFF_URL}/digital_objects/#{@digital_object_id}" |
| 42 | + |
| 43 | + expect(page).to have_text 'Record Not Found' |
| 44 | + expect(page).to have_text "The record you've tried to access may no longer exist or you may not have permission to view it." |
| 45 | +end |
| 46 | + |
| 47 | +Then 'the Digital Object can be accessed by archivists' do |
| 48 | + visit "#{STAFF_URL}/logout" |
| 49 | + |
| 50 | + login_archivist |
| 51 | + |
| 52 | + visit "#{STAFF_URL}/digital_objects/#{@digital_object_id}/edit" |
| 53 | + expect(current_url).to include "/digital_objects/#{@digital_object_id}/edit" |
| 54 | +end |
0 commit comments