diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 10:34:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 10:34:06 +0000 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /spec/lib/gitlab/diff/inline_diff_spec.rb | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) | |
download | gitlab-ce-859a6fb938bb9ee2a317c46dfa4fcc1af49608f0.tar.gz |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'spec/lib/gitlab/diff/inline_diff_spec.rb')
-rw-r--r-- | spec/lib/gitlab/diff/inline_diff_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/lib/gitlab/diff/inline_diff_spec.rb b/spec/lib/gitlab/diff/inline_diff_spec.rb index 35284e952f7..dce655d5690 100644 --- a/spec/lib/gitlab/diff/inline_diff_spec.rb +++ b/spec/lib/gitlab/diff/inline_diff_spec.rb @@ -37,6 +37,33 @@ RSpec.describe Gitlab::Diff::InlineDiff do it 'can handle unchanged empty lines' do expect { described_class.for_lines(['- bar', '+ baz', '']) }.not_to raise_error end + + context 'when lines have multiple changes' do + let(:diff) do + <<~EOF + - Hello, how are you? + + Hi, how are you doing? + EOF + end + + let(:subject) { described_class.for_lines(diff.lines) } + + it 'finds all inline diffs' do + expect(subject[0]).to eq([3..6]) + expect(subject[1]).to eq([3..3, 17..22]) + end + + context 'when feature flag is disabled' do + before do + stub_feature_flags(improved_merge_diff_highlighting: false) + end + + it 'finds all inline diffs' do + expect(subject[0]).to eq([3..19]) + expect(subject[1]).to eq([3..22]) + end + end + end end describe "#inline_diffs" do |