diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-17 03:07:27 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-17 03:07:27 +0300 |
commit | b7e6df1abde1112ae1fa0778f45d6053eec3f052 (patch) | |
tree | a879d991b78433cbf419e4968c410982802dece3 /spec/models/snippet_spec.rb | |
parent | e924e9e7cb9df21b3bc3d51d5f955da28ba3a225 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/snippet_spec.rb')
-rw-r--r-- | spec/models/snippet_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/models/snippet_spec.rb b/spec/models/snippet_spec.rb index 3524cdae3b8..15dcccb37d9 100644 --- a/spec/models/snippet_spec.rb +++ b/spec/models/snippet_spec.rb @@ -133,6 +133,32 @@ describe Snippet do end end + describe 'when default snippet visibility set to internal' do + using RSpec::Parameterized::TableSyntax + + before do + stub_application_setting(default_snippet_visibility: Gitlab::VisibilityLevel::INTERNAL) + end + + where(:attribute_name, :value) do + :visibility | 'private' + :visibility_level | Gitlab::VisibilityLevel::PRIVATE + 'visibility' | 'private' + 'visibility_level' | Gitlab::VisibilityLevel::PRIVATE + end + + with_them do + it 'sets the visibility level' do + snippet = described_class.new(attribute_name => value, title: 'test', file_name: 'test.rb', content: 'test data') + + expect(snippet.visibility_level).to eq(Gitlab::VisibilityLevel::PRIVATE) + expect(snippet.title).to eq('test') + expect(snippet.file_name).to eq('test.rb') + expect(snippet.content).to eq('test data') + end + end + end + describe '.with_optional_visibility' do context 'when a visibility level is provided' do it 'returns snippets with the given visibility' do |