diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-19 09:06:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-19 09:06:07 +0300 |
commit | 3209c1a49c14cab93eb347bfca59bace30879440 (patch) | |
tree | c9f931b477fefc1e5056380eb3370c689c2fa732 /spec/models/snippet_spec.rb | |
parent | 7f3bff1556594dcdc1beca40d083ba7263965e21 (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 | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/models/snippet_spec.rb b/spec/models/snippet_spec.rb index e4cc8931840..cfc0703af23 100644 --- a/spec/models/snippet_spec.rb +++ b/spec/models/snippet_spec.rb @@ -451,4 +451,20 @@ describe Snippet do expect(blob.data).to eq(snippet.content) end end + + describe '#to_json' do + let(:snippet) { build(:snippet) } + + it 'excludes secret_token from generated json' do + expect(JSON.parse(to_json).keys).not_to include("secret_token") + end + + it 'does not override existing exclude option value' do + expect(JSON.parse(to_json(except: [:id])).keys).not_to include("secret_token", "id") + end + + def to_json(params = {}) + snippet.to_json(params) + end + end end |