diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-06 21:08:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-06 21:08:09 +0300 |
commit | 1287690a3678ad0ec21c9b2f3b21ae18257d5e22 (patch) | |
tree | 96162972275004dcaef6376fe324ee2a7a549833 /spec/models | |
parent | d4806ad7dbd2d87ae09872709fef1aef35792e21 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/diff_viewer/server_side_spec.rb | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/spec/models/diff_viewer/server_side_spec.rb b/spec/models/diff_viewer/server_side_spec.rb index 28660b0d4b9..db0814af422 100644 --- a/spec/models/diff_viewer/server_side_spec.rb +++ b/spec/models/diff_viewer/server_side_spec.rb @@ -17,10 +17,30 @@ RSpec.describe DiffViewer::ServerSide do subject { viewer_class.new(diff_file) } describe '#prepare!' do - it 'loads all diff file data' do - expect(Blob).to receive(:lazy).at_least(:twice) + before do + stub_feature_flags(disable_load_entire_blob_for_diff_viewer: feature_flag_enabled) + end + + context 'when the disable_load_entire_blob_for_diff_viewer flag is disabled' do + let(:feature_flag_enabled) { false } - subject.prepare! + it 'loads all diff file data' do + subject + expect(diff_file).to receive_message_chain(:old_blob, :load_all_data!) + expect(diff_file).to receive_message_chain(:new_blob, :load_all_data!) + subject.prepare! + end + end + + context 'when the disable_load_entire_blob_for_diff_viewer flag is enabled' do + let(:feature_flag_enabled) { true } + + it 'does not load file data' do + subject + expect(diff_file).not_to receive(:old_blob) + expect(diff_file).not_to receive(:new_blob) + subject.prepare! + end end end |