debian-mirror-gitlab/spec/controllers/admin/projects_controller_spec.rb

46 lines
1.2 KiB
Ruby
Raw Normal View History

2016-06-02 11:05:42 +05:30
require 'spec_helper'
describe Admin::ProjectsController do
2017-09-10 17:25:29 +05:30
let!(:project) { create(:project, :public) }
2016-06-02 11:05:42 +05:30
before do
sign_in(create(:admin))
end
describe 'GET /projects' do
render_views
it 'retrieves the project for the given visibility level' do
2016-08-24 12:49:21 +05:30
get :index, visibility_level: [Gitlab::VisibilityLevel::PUBLIC]
2017-09-10 17:25:29 +05:30
2016-06-02 11:05:42 +05:30
expect(response.body).to match(project.name)
end
it 'does not retrieve the project' do
2016-08-24 12:49:21 +05:30
get :index, visibility_level: [Gitlab::VisibilityLevel::INTERNAL]
2017-09-10 17:25:29 +05:30
expect(response.body).not_to match(project.name)
2016-06-02 11:05:42 +05:30
end
2017-09-10 17:25:29 +05:30
it 'does not respond with projects pending deletion' do
pending_delete_project = create(:project, pending_delete: true)
get :index
2018-03-17 18:26:18 +05:30
expect(response).to have_gitlab_http_status(200)
2017-09-10 17:25:29 +05:30
expect(response.body).not_to match(pending_delete_project.name)
expect(response.body).to match(project.name)
end
2018-03-27 19:54:05 +05:30
it 'does not have N+1 queries', :use_clean_rails_memory_store_caching, :request_store do
get :index
control_count = ActiveRecord::QueryRecorder.new { get :index }.count
create(:project)
expect { get :index }.not_to exceed_query_limit(control_count)
end
2016-06-02 11:05:42 +05:30
end
end