Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-19 09:06:07 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-19 09:06:07 +0300
commit3209c1a49c14cab93eb347bfca59bace30879440 (patch)
treec9f931b477fefc1e5056380eb3370c689c2fa732 /spec/models/snippet_spec.rb
parent7f3bff1556594dcdc1beca40d083ba7263965e21 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/snippet_spec.rb')
-rw-r--r--spec/models/snippet_spec.rb16
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