diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-24 06:08:44 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-24 06:08:44 +0300 |
commit | 4870899d6cec693b58acbef91636e1310160fa28 (patch) | |
tree | 305628a2a8436e77b0c3972f8053df771a89843c /spec/models | |
parent | 082b24b03bbb9dca7edf1341aa7b0a51c9aeb18b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/repository_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index e2a148165ab..a9021e5771c 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -2895,6 +2895,29 @@ describe Repository do end end + describe '#project' do + it 'returns the project for a project snippet' do + snippet = create(:project_snippet) + + expect(snippet.repository.project).to be(snippet.project) + end + + it 'returns nil for a personal snippet' do + snippet = create(:personal_snippet) + + expect(snippet.repository.project).to be_nil + end + + it 'returns the container if it is a project' do + expect(repository.project).to be(project) + end + + it 'returns nil if the container is not a project' do + expect(repository).to receive(:container).and_return(Group.new) + expect(repository.project).to be_nil + end + end + describe '#submodule_links' do it 'returns an instance of Gitlab::SubmoduleLinks' do expect(repository.submodule_links).to be_a(Gitlab::SubmoduleLinks) |