diff options
author | Ash McKenzie <amckenzie@gitlab.com> | 2018-06-10 22:56:17 +1000 |
---|---|---|
committer | Ash McKenzie <amckenzie@gitlab.com> | 2018-06-13 12:11:38 +1000 |
commit | 2f297034036055aaf37f86ece22723aedf8741bf (patch) | |
tree | 731fab3c82dd23d63ba9b89ad101d11e409d2fe0 /spec/models/snippet_spec.rb | |
parent | f646a8b9bc95fd6cecaa754f7dd0e8370c201502 (diff) | |
download | gitlab-ce-ash.mckenzie/secret-snippets.tar.gz |
Diffstat (limited to 'spec/models/snippet_spec.rb')
-rw-r--r-- | spec/models/snippet_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/models/snippet_spec.rb b/spec/models/snippet_spec.rb index e09d89d235d..81dedc89343 100644 --- a/spec/models/snippet_spec.rb +++ b/spec/models/snippet_spec.rb @@ -212,4 +212,23 @@ describe Snippet do expect(blob.data).to eq(snippet.content) end end + + describe '#ensure_secret_word_added_if_needed' do + let(:snippet) { create(:snippet) } + + context 'visibility_level is SECRET' do + it 'assigns a random hex value' do + snippet.visibility_level = Gitlab::VisibilityLevel::SECRET + snippet.save + expect(snippet.secret_word).not_to be_nil + end + end + + context 'visibility_level is NOT SECRET' do + it 'assigns a random hex value' do + snippet.save + expect(snippet.secret_word).to be_nil + end + end + end end |