diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
commit | 48aff82709769b098321c738f3444b9bdaa694c6 (patch) | |
tree | e00c7c43e2d9b603a5a6af576b1685e400410dee /spec/lib/api/entities/snippet_spec.rb | |
parent | 879f5329ee916a948223f8f43d77fba4da6cd028 (diff) |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'spec/lib/api/entities/snippet_spec.rb')
-rw-r--r-- | spec/lib/api/entities/snippet_spec.rb | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/spec/lib/api/entities/snippet_spec.rb b/spec/lib/api/entities/snippet_spec.rb index 068851f7f6c..090f09c9b61 100644 --- a/spec/lib/api/entities/snippet_spec.rb +++ b/spec/lib/api/entities/snippet_spec.rb @@ -21,16 +21,6 @@ RSpec.describe ::API::Entities::Snippet do it { expect(subject[:visibility]).to eq snippet.visibility } it { expect(subject).to include(:author) } - context 'with snippet_multiple_files feature disabled' do - before do - stub_feature_flags(snippet_multiple_files: false) - end - - it 'does not return files' do - expect(subject).not_to include(:files) - end - end - describe 'file_name' do it 'returns attribute from repository' do expect(subject[:file_name]).to eq snippet.blobs.first.path @@ -77,14 +67,6 @@ RSpec.describe ::API::Entities::Snippet do let(:blob) { snippet.blobs.first } let(:ref) { blob.repository.root_ref } - context 'when repository does not exist' do - it 'does not include the files attribute' do - allow(snippet).to receive(:repository_exists?).and_return(false) - - expect(subject).not_to include(:files) - end - end - shared_examples 'snippet files' do let(:file) { subject[:files].first } @@ -99,6 +81,14 @@ RSpec.describe ::API::Entities::Snippet do it 'has the raw url' do expect(file[:raw_url]).to match(raw_url) end + + context 'when repository does not exist' do + it 'returns empty array' do + allow(snippet.repository).to receive(:empty?).and_return(true) + + expect(subject[:files]).to be_empty + end + end end context 'with PersonalSnippet' do |