diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-28 12:08:19 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-28 12:08:19 +0300 |
commit | 79659fe1fe45f2bdd13cd1a3980fbf1714caad57 (patch) | |
tree | 6dc2d9e7a3543d5346337c5056331c70f736e950 /spec/lib | |
parent | 6047d21a899cba25dfb554cca1776fed689dc951 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/diff/file_collection/base_spec.rb | 27 | ||||
-rw-r--r-- | spec/lib/gitlab/diff/file_collection/merge_request_diff_base_spec.rb | 28 |
2 files changed, 55 insertions, 0 deletions
diff --git a/spec/lib/gitlab/diff/file_collection/base_spec.rb b/spec/lib/gitlab/diff/file_collection/base_spec.rb new file mode 100644 index 00000000000..00d3aa47301 --- /dev/null +++ b/spec/lib/gitlab/diff/file_collection/base_spec.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Gitlab::Diff::FileCollection::Base do + let(:merge_request) { create(:merge_request) } + let(:diffable) { merge_request.merge_request_diff } + let(:diff_options) { {} } + + describe '#overflow?' do + subject(:overflown) { described_class.new(diffable, project: merge_request.project, diff_options: diff_options).overflow? } + + context 'when it is not overflown' do + it 'returns false' do + expect(overflown).to eq(false) + end + end + + context 'when it is overflown' do + let(:diff_options) { { max_files: 1 } } + + it 'returns true' do + expect(overflown).to eq(true) + end + end + end +end diff --git a/spec/lib/gitlab/diff/file_collection/merge_request_diff_base_spec.rb b/spec/lib/gitlab/diff/file_collection/merge_request_diff_base_spec.rb new file mode 100644 index 00000000000..022ee5504d6 --- /dev/null +++ b/spec/lib/gitlab/diff/file_collection/merge_request_diff_base_spec.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Gitlab::Diff::FileCollection::MergeRequestDiffBase do + let(:merge_request) { create(:merge_request) } + let(:diffable) { merge_request.merge_request_diff } + + describe '#overflow?' do + subject(:overflown) { described_class.new(diffable, diff_options: nil).overflow? } + + context 'when it is not overflown' do + it 'returns false' do + expect(overflown).to eq(false) + end + end + + context 'when it is overflown' do + before do + diffable.update!(state: :overflow) + end + + it 'returns true' do + expect(overflown).to eq(true) + end + end + end +end |