diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-06-20 08:29:47 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-06-20 08:29:47 +0000 |
commit | c67d8c2478cd569d16bf2f4e9a950ca4ca395acb (patch) | |
tree | 3096bf3bebfbeb9949fb671e1d3ece3d809022de /spec | |
parent | 3e99adc90dcce226cb33b360e031ab157c08667f (diff) | |
parent | 64cda7746c08939306a6b98751d5a5c5280cc5b9 (diff) | |
download | gitlab-ce-c67d8c2478cd569d16bf2f4e9a950ca4ca395acb.tar.gz |
Merge branch 'zj-lfs-pointers' into 'master'
LFS changes are detected by Gitaly
Closes gitaly#935
See merge request gitlab-org/gitlab-ce!19995
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/git/lfs_changes_spec.rb | 41 |
1 files changed, 5 insertions, 36 deletions
diff --git a/spec/lib/gitlab/git/lfs_changes_spec.rb b/spec/lib/gitlab/git/lfs_changes_spec.rb index d0dd8c6303f..c5e7ab959b2 100644 --- a/spec/lib/gitlab/git/lfs_changes_spec.rb +++ b/spec/lib/gitlab/git/lfs_changes_spec.rb @@ -1,50 +1,19 @@ require 'spec_helper' describe Gitlab::Git::LfsChanges do - let(:project) { create(:project, :repository) } + set(:project) { create(:project, :repository) } let(:newrev) { '54fcc214b94e78d7a41a9a8fe6d87a5e59500e51' } let(:blob_object_id) { '0c304a93cb8430108629bbbcaa27db3343299bc0' } subject { described_class.new(project.repository, newrev) } describe '#new_pointers' do - shared_examples 'new pointers' do - it 'filters new objects to find lfs pointers' do - expect(subject.new_pointers(not_in: []).first.id).to eq(blob_object_id) - end - - it 'limits new_objects using object_limit' do - expect(subject.new_pointers(object_limit: 1)).to eq([]) - end - end - - context 'with gitaly enabled' do - it_behaves_like 'new pointers' + it 'filters new objects to find lfs pointers' do + expect(subject.new_pointers(not_in: []).first.id).to eq(blob_object_id) end - context 'with gitaly disabled', :skip_gitaly_mock do - it_behaves_like 'new pointers' - - it 'uses rev-list to find new objects' do - rev_list = double - allow(Gitlab::Git::RevList).to receive(:new).and_return(rev_list) - - expect(rev_list).to receive(:new_objects).and_return([]) - - subject.new_pointers - end - end - end - - describe '#all_pointers', :skip_gitaly_mock do - it 'uses rev-list to find all objects' do - rev_list = double - allow(Gitlab::Git::RevList).to receive(:new).and_return(rev_list) - allow(rev_list).to receive(:all_objects).and_yield([blob_object_id]) - - expect(Gitlab::Git::Blob).to receive(:batch_lfs_pointers).with(project.repository, [blob_object_id]) - - subject.all_pointers + it 'limits new_objects using object_limit' do + expect(subject.new_pointers(object_limit: 1)).to eq([]) end end end |