diff options
author | Reuben Pereira <rpereira@gitlab.com> | 2019-02-21 14:19:51 +0300 |
---|---|---|
committer | Kamil TrzciĆski <ayufan@ayufan.eu> | 2019-02-21 14:19:51 +0300 |
commit | 536463295c2598505135bc61570ea66e1bad6496 (patch) | |
tree | 4bb61e295d682140d3c0cf8d9c3923e49e9e8e2b /spec/models/error_tracking | |
parent | 56b82db63a91695a1dec1b7cbf39636bb01ad3df (diff) |
Catch exception in calculate reactive cache
Return the exception as an error.
Diffstat (limited to 'spec/models/error_tracking')
-rw-r--r-- | spec/models/error_tracking/project_error_tracking_setting_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/models/error_tracking/project_error_tracking_setting_spec.rb b/spec/models/error_tracking/project_error_tracking_setting_spec.rb index d30228b863c..076ccc96041 100644 --- a/spec/models/error_tracking/project_error_tracking_setting_spec.rb +++ b/spec/models/error_tracking/project_error_tracking_setting_spec.rb @@ -145,6 +145,24 @@ describe ErrorTracking::ProjectErrorTrackingSetting do expect(result).to be_nil end end + + context 'when sentry client raises exception' do + let(:sentry_client) { spy(:sentry_client) } + + before do + synchronous_reactive_cache(subject) + + allow(subject).to receive(:sentry_client).and_return(sentry_client) + allow(sentry_client).to receive(:list_issues).with(opts) + .and_raise(Sentry::Client::Error, 'error message') + end + + it 'returns error' do + expect(result).to eq(error: 'error message') + expect(subject).to have_received(:sentry_client) + expect(sentry_client).to have_received(:list_issues) + end + end end describe '#list_sentry_projects' do |