diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-11 03:06:26 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-11 03:06:26 +0300 |
commit | 991a295378736c60d419c794f0accbf0336987fc (patch) | |
tree | aaee5152256c8d4eb40a1583521bcf320082bb49 /spec/support/shared_examples/serializers | |
parent | 71d998ca0de672d5accdf209b4b5e3f360ea5267 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/shared_examples/serializers')
-rw-r--r-- | spec/support/shared_examples/serializers/diff_file_entity_examples.rb | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/spec/support/shared_examples/serializers/diff_file_entity_examples.rb b/spec/support/shared_examples/serializers/diff_file_entity_examples.rb index 96cb71be737..d2c269c597c 100644 --- a/spec/support/shared_examples/serializers/diff_file_entity_examples.rb +++ b/spec/support/shared_examples/serializers/diff_file_entity_examples.rb @@ -31,14 +31,43 @@ shared_examples 'diff file entity' do it 'exposes correct attributes' do expect(subject).to include(:added_lines, :removed_lines, - :context_lines_path, :highlighted_diff_lines, - :parallel_diff_lines) + :context_lines_path) end it 'includes viewer' do expect(subject[:viewer].with_indifferent_access) .to match_schema('entities/diff_viewer') end + + context 'diff files' do + context 'when diff_view is parallel' do + let(:options) { { diff_view: :parallel } } + + it 'contains only the parallel diff lines', :aggregate_failures do + expect(subject).to include(:parallel_diff_lines) + expect(subject).not_to include(:highlighted_diff_lines) + end + end + + context 'when diff_view is parallel' do + let(:options) { { diff_view: :inline } } + + it 'contains only the inline diff lines', :aggregate_failures do + expect(subject).not_to include(:parallel_diff_lines) + expect(subject).to include(:highlighted_diff_lines) + end + end + + context 'when the `single_mr_diff_view` feature is disabled' do + before do + stub_feature_flags(single_mr_diff_view: false) + end + + it 'contains both kinds of diffs' do + expect(subject).to include(:highlighted_diff_lines, :parallel_diff_lines) + end + end + end end shared_examples 'diff file discussion entity' do |