summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/diff
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2018-04-13 18:32:54 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2018-04-17 11:39:23 +0200
commit5f7f5eda925801cdc3b0932a3485a00d967c916c (patch)
tree99b002aff3e5a98110571d950f0569fee164269a /spec/lib/gitlab/diff
parenta56611e3892b9039f6a8196c37d8b70a3c86c68b (diff)
downloadgitlab-ce-5f7f5eda925801cdc3b0932a3485a00d967c916c.tar.gz
Method to track recoverable exceptions in sentry
This adds a method to track errors that can be recovered from in sentry. It is useful when debugging performance issues, or exceptions that are hard to reproduce.
Diffstat (limited to 'spec/lib/gitlab/diff')
-rw-r--r--spec/lib/gitlab/diff/highlight_spec.rb9
1 files changed, 4 insertions, 5 deletions
diff --git a/spec/lib/gitlab/diff/highlight_spec.rb b/spec/lib/gitlab/diff/highlight_spec.rb
index 73d60c021c8..7c9e8c8d04e 100644
--- a/spec/lib/gitlab/diff/highlight_spec.rb
+++ b/spec/lib/gitlab/diff/highlight_spec.rb
@@ -79,6 +79,8 @@ describe Gitlab::Diff::Highlight do
end
it 'keeps the original rich line' do
+ allow(Gitlab::Sentry).to receive(:track_exception)
+
code = %q{+ raise RuntimeError, "System commands must be given as an array of strings"}
expect(subject[5].text).to eq(code)
@@ -86,12 +88,9 @@ describe Gitlab::Diff::Highlight do
end
it 'reports to Sentry if configured' do
- allow(Gitlab::Sentry).to receive(:enabled?).and_return(true)
-
- expect(Gitlab::Sentry).to receive(:context)
- expect(Raven).to receive(:capture_exception)
+ expect(Gitlab::Sentry).to receive(:track_exception).and_call_original
- subject
+ expect { subject }. to raise_exception(RangeError)
end
end
end