Commit d11a0cbb authored by Mark Florian's avatar Mark Florian

Add test for unauthorized user

parent c0e443ad
......@@ -3,18 +3,15 @@
require 'spec_helper'
describe Projects::DependenciesController do
set(:project) { create(:project, :repository, :public) }
set(:project) { create(:project, :repository, :private) }
set(:user) { create(:user) }
subject { get :show, params: { namespace_id: project.namespace, project_id: project } }
before do
project.add_developer(user)
end
describe 'GET show' do
context 'with authorized user' do
before do
project.add_developer(user)
sign_in(user)
end
......@@ -41,6 +38,15 @@ describe Projects::DependenciesController do
end
context 'with unauthorized user' do
before do
sign_in(user)
end
context 'when feature is available' do
before do
stub_licensed_features(dependency_list: true)
end
it 'returns 404' do
subject
......@@ -48,4 +54,13 @@ describe Projects::DependenciesController do
end
end
end
context 'with anonymous user' do
it 'returns 302' do
subject
expect(response).to have_gitlab_http_status(302)
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment