|
62 | 62 | context 'when the parent Editor__c is not yet synced to Salesforce' do |
63 | 63 | before { sf_school.update!(sfid: nil) } |
64 | 64 |
|
65 | | - it 'raises SalesforceRecordNotFound to defer the affiliation write' do |
66 | | - expect { perform_job } |
67 | | - .to raise_error(Salesforce::SalesforceSyncJob::SalesforceRecordNotFound, /Editor__c not yet synced/) |
| 65 | + it 'retries the job to defer the affiliation write' do |
| 66 | + expect { perform_job }.to have_enqueued_job(described_class).with(role_id: role.id) |
68 | 67 | end |
69 | 68 |
|
70 | 69 | it 'does not write the affiliation to the mirror' do |
71 | | - expect { perform_job }.to raise_error(Salesforce::SalesforceSyncJob::SalesforceRecordNotFound) |
| 70 | + perform_job |
72 | 71 | expect(Salesforce::Role.find_by(affiliation_id__c: role.id)).to be_nil |
73 | 72 | end |
74 | 73 | end |
75 | 74 |
|
76 | 75 | context 'when there is no Salesforce::School row for the role school' do |
77 | 76 | before { sf_school.destroy } |
78 | 77 |
|
79 | | - it 'raises SalesforceRecordNotFound' do |
80 | | - expect { perform_job } |
81 | | - .to raise_error(Salesforce::SalesforceSyncJob::SalesforceRecordNotFound, /Editor__c not yet synced/) |
| 78 | + it 'retries the job' do |
| 79 | + expect { perform_job }.to have_enqueued_job(described_class).with(role_id: role.id) |
82 | 80 | end |
83 | 81 | end |
84 | 82 |
|
85 | 83 | context 'when the parent Contact is not yet synced to Salesforce' do |
86 | 84 | before { sf_contact.update!(sfid: nil) } |
87 | 85 |
|
88 | | - it 'raises SalesforceRecordNotFound to defer the affiliation write' do |
89 | | - expect { perform_job } |
90 | | - .to raise_error(Salesforce::SalesforceSyncJob::SalesforceRecordNotFound, /Contact not yet synced/) |
| 86 | + it 'retries the job to defer the affiliation write' do |
| 87 | + expect { perform_job }.to have_enqueued_job(described_class).with(role_id: role.id) |
91 | 88 | end |
92 | 89 |
|
93 | 90 | it 'does not write the affiliation to the mirror' do |
94 | | - expect { perform_job }.to raise_error(Salesforce::SalesforceSyncJob::SalesforceRecordNotFound) |
| 91 | + perform_job |
95 | 92 | expect(Salesforce::Role.find_by(affiliation_id__c: role.id)).to be_nil |
96 | 93 | end |
97 | 94 | end |
98 | 95 |
|
99 | 96 | context 'when there is no Salesforce::Contact row for the role user' do |
100 | 97 | before { sf_contact.destroy } |
101 | 98 |
|
102 | | - it 'raises SalesforceRecordNotFound' do |
103 | | - expect { perform_job } |
104 | | - .to raise_error(Salesforce::SalesforceSyncJob::SalesforceRecordNotFound, /Contact not yet synced/) |
| 99 | + it 'retries the job' do |
| 100 | + expect { perform_job }.to have_enqueued_job(described_class).with(role_id: role.id) |
105 | 101 | end |
106 | 102 | end |
107 | 103 |
|
|
0 commit comments