diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-29 21:06:13 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-29 21:06:13 +0000 |
commit | 839c080dd0976f19c274eee1331c47985490cd41 (patch) | |
tree | da3af62d5469f80c7555f9e8df11c18049e0334e /spec/controllers/snippets_controller_spec.rb | |
parent | 8263f6ee3131cdea3c6041785c32771a6af0b24f (diff) | |
download | gitlab-ce-839c080dd0976f19c274eee1331c47985490cd41.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers/snippets_controller_spec.rb')
-rw-r--r-- | spec/controllers/snippets_controller_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/controllers/snippets_controller_spec.rb b/spec/controllers/snippets_controller_spec.rb index 054d448c28d..510db4374c0 100644 --- a/spec/controllers/snippets_controller_spec.rb +++ b/spec/controllers/snippets_controller_spec.rb @@ -53,6 +53,16 @@ describe SnippetsController do expect(response).to have_gitlab_http_status(200) end + + context 'when user is not allowed to create a personal snippet' do + let(:user) { create(:user, :external) } + + it 'responds with status 404' do + get :new + + expect(response).to have_gitlab_http_status(404) + end + end end context 'when not signed in' do @@ -215,6 +225,20 @@ describe SnippetsController do expect(snippet.description).to eq('Description') end + context 'when user is not allowed to create a personal snippet' do + let(:user) { create(:user, :external) } + + it 'responds with status 404' do + aggregate_failures do + expect do + create_snippet(visibility_level: Snippet::PUBLIC) + end.not_to change { Snippet.count } + + expect(response).to have_gitlab_http_status(404) + end + end + end + context 'when the snippet description contains a file' do include FileMoverHelpers |