diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-02-22 14:51:20 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-02-22 14:51:20 +0000 |
commit | e28a4a5b6cdd634cde58ef8d86aefdb5c26839ea (patch) | |
tree | 190bd0084de09535c72613974a5349dd21bd38c7 /spec/lib | |
parent | 700e2a165bdfd7906f6f4bad5495c890f814f277 (diff) | |
parent | cdf3ae04f84abe039b79ab31192bb7c462bf7ce5 (diff) | |
download | gitlab-ce-e28a4a5b6cdd634cde58ef8d86aefdb5c26839ea.tar.gz |
Merge branch '42332-actionview-template-error-366-524-out-of-range' into 'master'
Resolve "ActionView::Template::Error: 366..524 out of range"
Closes #42332
See merge request gitlab-org/gitlab-ce!17262
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/diff/highlight_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/lib/gitlab/diff/highlight_spec.rb b/spec/lib/gitlab/diff/highlight_spec.rb index cd602ccab8e..73d60c021c8 100644 --- a/spec/lib/gitlab/diff/highlight_spec.rb +++ b/spec/lib/gitlab/diff/highlight_spec.rb @@ -72,6 +72,28 @@ describe Gitlab::Diff::Highlight do expect(subject[5].text).to eq(code) expect(subject[5].text).to be_html_safe end + + context 'when the inline diff marker has an invalid range' do + before do + allow_any_instance_of(Gitlab::Diff::InlineDiffMarker).to receive(:mark).and_raise(RangeError) + end + + it 'keeps the original rich line' do + code = %q{+ raise RuntimeError, "System commands must be given as an array of strings"} + + expect(subject[5].text).to eq(code) + expect(subject[5].text).not_to be_html_safe + 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) + + subject + end + end end end end |