|
52 | 52 | allow(mock_faraday_connection).to receive(:post).and_return dummy_response |
53 | 53 | end |
54 | 54 |
|
55 | | - context 'when the user is not an active member' do |
56 | | - let!(:inactive_member) { object_double(PsuIdentity::SearchService::Person.new, affiliation: ['MEMBER']) } |
57 | | - |
58 | | - before do |
59 | | - allow(mock_identity_search).to receive(:userid).and_return(inactive_member) |
60 | | - end |
61 | | - |
62 | | - it 'raises an error' do |
63 | | - expect { described_class.new.admin_create_ticket(work.id) }.to raise_error( |
64 | | - LibanswersApiService::LibanswersApiError, I18n.t('resources.contact_depositor_button.error_message') |
65 | | - ) |
66 | | - end |
67 | | - end |
68 | | - |
69 | 55 | context 'when the ticket is a Work Curation Ticket' do |
70 | 56 | it 'uses id 5477 for quid and ScholarSphere Deposit Curation for question' do |
71 | 57 | described_class.new.admin_create_ticket(work.id, 'work_curation') |
|
75 | 61 | work.latest_version.title}&pname=#{work.display_name}&pemail=#{work.email}" |
76 | 62 | ) |
77 | 63 | end |
| 64 | + |
| 65 | + context 'when the user is not an active member' do |
| 66 | + let!(:inactive_member) { object_double(PsuIdentity::SearchService::Person.new, affiliation: ['MEMBER']) } |
| 67 | + |
| 68 | + before do |
| 69 | + allow(mock_identity_search).to receive(:userid).and_return(inactive_member) |
| 70 | + end |
| 71 | + |
| 72 | + it 'raises an error' do |
| 73 | + expect { described_class.new.admin_create_ticket(work.id, 'work_curation') }.to raise_error( |
| 74 | + LibanswersApiService::LibanswersApiError, I18n.t('resources.contact_depositor_button.error_message') |
| 75 | + ) |
| 76 | + end |
| 77 | + end |
78 | 78 | end |
79 | 79 |
|
80 | 80 | context 'when the ticket is a Collection Curation Ticket' do |
|
86 | 86 | collection.metadata['title']}&pname=#{collection.depositor.display_name}&pemail=#{work.depositor.email}" |
87 | 87 | ) |
88 | 88 | end |
| 89 | + |
| 90 | + context 'when the user is not an active member' do |
| 91 | + let!(:inactive_member) { object_double(PsuIdentity::SearchService::Person.new, affiliation: ['MEMBER']) } |
| 92 | + |
| 93 | + before do |
| 94 | + allow(mock_identity_search).to receive(:userid).and_return(inactive_member) |
| 95 | + end |
| 96 | + |
| 97 | + it 'raises an error' do |
| 98 | + expect { described_class.new.admin_create_ticket(collection.id, 'collection') }.to raise_error( |
| 99 | + LibanswersApiService::LibanswersApiError, I18n.t('resources.contact_depositor_button.error_message') |
| 100 | + ) |
| 101 | + end |
| 102 | + end |
89 | 103 | end |
90 | 104 |
|
91 | 105 | context 'when the ticket is a Work Accessibility Ticket' do |
|
100 | 114 | ) |
101 | 115 | end |
102 | 116 |
|
| 117 | + context 'when the user is not an active member' do |
| 118 | + let!(:inactive_member) { object_double(PsuIdentity::SearchService::Person.new, affiliation: ['MEMBER']) } |
| 119 | + |
| 120 | + before do |
| 121 | + allow(mock_identity_search).to receive(:userid).and_return(inactive_member) |
| 122 | + end |
| 123 | + |
| 124 | + it 'creates a ticket' do |
| 125 | + described_class.new.admin_create_ticket(work.id, 'work_accessibility', base_url) |
| 126 | + expect(mock_faraday_connection).to have_received(:post).with( |
| 127 | + '/api/1.1/ticket/create', |
| 128 | + "quid=#{accessibility_quid}&pquestion=ScholarSphere Deposit Accessibility Curation: #{ |
| 129 | + work.latest_version.title}&pname=#{work.display_name}&pemail=#{work.email}" |
| 130 | + ) |
| 131 | + end |
| 132 | + end |
| 133 | + |
103 | 134 | context 'when accessibility report exists' do |
104 | 135 | let!(:work_2) { create(:work, depositor: user.actor) } |
105 | 136 | let(:file_resource) { create(:file_resource, :pdf) } |
|
0 commit comments