summaryrefslogtreecommitdiff
path: root/spec/controllers/snippets_controller_spec.rb
diff options
context:
space:
mode:
authorMark Chao <mchao@gitlab.com>2018-12-11 14:32:25 +0800
committerMark Chao <mchao@gitlab.com>2018-12-20 14:32:51 +0800
commited0d691e0dfba54cd8f03706afd011afe4063a7a (patch)
tree25efce5071ce983bd99d74546af262075786cd15 /spec/controllers/snippets_controller_spec.rb
parent30c6db8f0354847c275335c120d7218c0098c41f (diff)
downloadgitlab-ce-ed0d691e0dfba54cd8f03706afd011afe4063a7a.tar.gz
Block private snippets from being embeddable
Diffstat (limited to 'spec/controllers/snippets_controller_spec.rb')
-rw-r--r--spec/controllers/snippets_controller_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/controllers/snippets_controller_spec.rb b/spec/controllers/snippets_controller_spec.rb
index 01a5161f775..af44598bfe4 100644
--- a/spec/controllers/snippets_controller_spec.rb
+++ b/spec/controllers/snippets_controller_spec.rb
@@ -80,6 +80,12 @@ describe SnippetsController do
expect(assigns(:snippet)).to eq(personal_snippet)
expect(response).to have_gitlab_http_status(200)
end
+
+ it 'responds with status 404 when embeddable content is requested' do
+ get :show, id: personal_snippet.to_param, format: :js
+
+ expect(response).to have_gitlab_http_status(404)
+ end
end
end
@@ -106,6 +112,12 @@ describe SnippetsController do
expect(assigns(:snippet)).to eq(personal_snippet)
expect(response).to have_gitlab_http_status(200)
end
+
+ it 'responds with status 404 when embeddable content is requested' do
+ get :show, id: personal_snippet.to_param, format: :js
+
+ expect(response).to have_gitlab_http_status(404)
+ end
end
context 'when not signed in' do
@@ -131,6 +143,13 @@ describe SnippetsController do
expect(assigns(:snippet)).to eq(personal_snippet)
expect(response).to have_gitlab_http_status(200)
end
+
+ it 'responds with status 200 when embeddable content is requested' do
+ get :show, id: personal_snippet.to_param, format: :js
+
+ expect(assigns(:snippet)).to eq(personal_snippet)
+ expect(response).to have_gitlab_http_status(200)
+ end
end
context 'when not signed in' do