diff options
Diffstat (limited to 'spec/lib/gitlab/checks/lfs_integrity_spec.rb')
-rw-r--r-- | spec/lib/gitlab/checks/lfs_integrity_spec.rb | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/spec/lib/gitlab/checks/lfs_integrity_spec.rb b/spec/lib/gitlab/checks/lfs_integrity_spec.rb index 4583cd72cfd..3468094ffa5 100644 --- a/spec/lib/gitlab/checks/lfs_integrity_spec.rb +++ b/spec/lib/gitlab/checks/lfs_integrity_spec.rb @@ -18,12 +18,18 @@ RSpec.describe Gitlab::Checks::LfsIntegrity do operations.commit_tree('8856a329dd38ca86dfb9ce5aa58a16d88cc119bd', "New LFS objects") end - subject { described_class.new(project, newrev, time_left) } + let(:newrevs) { [newrev] } + + subject { described_class.new(project, newrevs, time_left) } describe '#objects_missing?' do let(:blob_object) { repository.blob_at_branch('lfs', 'files/lfs/lfs_object.iso') } context 'with LFS not enabled' do + before do + allow(project).to receive(:lfs_enabled?).and_return(false) + end + it 'skips integrity check' do expect_any_instance_of(Gitlab::Git::LfsChanges).not_to receive(:new_pointers) @@ -36,8 +42,28 @@ RSpec.describe Gitlab::Checks::LfsIntegrity do allow(project).to receive(:lfs_enabled?).and_return(true) end + context 'nil rev' do + let(:newrevs) { [nil] } + + it 'skips integrity check' do + expect_any_instance_of(Gitlab::Git::LfsChanges).not_to receive(:new_pointers) + + expect(subject.objects_missing?).to be_falsey + end + end + context 'deletion' do - let(:newrev) { nil } + let(:newrevs) { [Gitlab::Git::BLANK_SHA] } + + it 'skips integrity check' do + expect_any_instance_of(Gitlab::Git::LfsChanges).not_to receive(:new_pointers) + + expect(subject.objects_missing?).to be_falsey + end + end + + context 'no changes' do + let(:newrevs) { [] } it 'skips integrity check' do expect_any_instance_of(Gitlab::Git::LfsChanges).not_to receive(:new_pointers) |