diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-05 03:07:52 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-05 03:07:52 +0000 |
commit | a0c1ba61c8e8c9195e3ad4deefc5c4cb5c6a1501 (patch) | |
tree | 0731210fac047fdfb04a8e907701e0efab8c897e /spec/models/project_spec.rb | |
parent | 77237c5a6b9044f58beabc54d3589e5fa09cbfba (diff) | |
download | gitlab-ce-a0c1ba61c8e8c9195e3ad4deefc5c4cb5c6a1501.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/project_spec.rb')
-rw-r--r-- | spec/models/project_spec.rb | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 56f4c68a913..ca6ff8606f5 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -5692,6 +5692,53 @@ describe Project do end end + describe '#all_lfs_objects_oids' do + let(:project) { create(:project) } + let(:lfs_object) { create(:lfs_object) } + let(:another_lfs_object) { create(:lfs_object) } + + subject { project.all_lfs_objects_oids } + + context 'when project has associated LFS objects' do + before do + create(:lfs_objects_project, lfs_object: lfs_object, project: project) + create(:lfs_objects_project, lfs_object: another_lfs_object, project: project) + end + + it 'returns OIDs of LFS objects' do + expect(subject).to match_array([lfs_object.oid, another_lfs_object.oid]) + end + + context 'and there are specified oids' do + subject { project.all_lfs_objects_oids(oids: [lfs_object.oid]) } + + it 'returns OIDs of LFS objects that match specified oids' do + expect(subject).to eq([lfs_object.oid]) + end + end + end + + context 'when fork has associated LFS objects to itself and source' do + let(:source) { create(:project) } + let(:project) { fork_project(source) } + + before do + create(:lfs_objects_project, lfs_object: lfs_object, project: source) + create(:lfs_objects_project, lfs_object: another_lfs_object, project: project) + end + + it 'returns OIDs of LFS objects' do + expect(subject).to match_array([lfs_object.oid, another_lfs_object.oid]) + end + end + + context 'when project has no associated LFS objects' do + it 'returns empty array' do + expect(subject).to be_empty + end + end + end + describe '#lfs_objects_oids' do let(:project) { create(:project) } let(:lfs_object) { create(:lfs_object) } @@ -5708,6 +5755,14 @@ describe Project do it 'returns OIDs of LFS objects' do expect(subject).to match_array([lfs_object.oid, another_lfs_object.oid]) end + + context 'and there are specified oids' do + subject { project.lfs_objects_oids(oids: [lfs_object.oid]) } + + it 'returns OIDs of LFS objects that match specified oids' do + expect(subject).to eq([lfs_object.oid]) + end + end end context 'when project has no associated LFS objects' do |