Commit 78646f9f authored by Yorick Peterse's avatar Yorick Peterse

Merge branch '6569-extract-ee-specific-files-lines-for-spec-controllers-admin' into 'master'

Resolve "Extract EE specific files/lines for spec/controllers/admin"

Closes #6569

See merge request gitlab-org/gitlab-ee!13280
parents 55ca66de da70aa07
# frozen_string_literal: true
require 'spec_helper'
describe Admin::ApplicationsController do
let(:admin) { create(:admin) }
let(:application) { create(:oauth_application, owner_id: nil, owner_type: nil) }
before do
sign_in(admin)
end
describe 'POST #create' do
it 'creates the application' do
stub_licensed_features(extended_audit_events: true)
create_params = attributes_for(:application, trusted: true)
expect do
post :create, params: { doorkeeper_application: create_params }
end.to change { SecurityEvent.count }.by(1)
end
end
end
# frozen_string_literal: true
require 'spec_helper'
describe Admin::DashboardController do
describe '#index' do
it "allows an admin user to access the page" do
sign_in(create(:user, :admin))
get :index
expect(response).to have_gitlab_http_status(200)
end
it "does not allow an auditor user to access the page" do
sign_in(create(:user, :auditor))
get :index
expect(response).to have_gitlab_http_status(404)
end
it "does not allow a regular user to access the page" do
sign_in(create(:user))
get :index
expect(response).to have_gitlab_http_status(404)
end
end
end
......@@ -30,8 +30,6 @@ describe Admin::ApplicationsController do
describe 'POST #create' do
it 'creates the application' do
stub_licensed_features(extended_audit_events: true)
create_params = attributes_for(:application, trusted: true)
expect do
......@@ -42,7 +40,6 @@ describe Admin::ApplicationsController do
expect(response).to redirect_to(admin_application_path(application))
expect(application).to have_attributes(create_params.except(:uid, :owner_type))
expect(SecurityEvent.count).to eq(1)
end
it 'renders the application form on errors' do
......
......@@ -4,27 +4,6 @@ require 'spec_helper'
describe Admin::DashboardController do
describe '#index' do
it "allows an admin user to access the page" do
sign_in(create(:user, :admin))
get :index
expect(response).to have_gitlab_http_status(200)
end
it "does not allow an auditor user to access the page" do
sign_in(create(:user, :auditor))
get :index
expect(response).to have_gitlab_http_status(404)
end
it "does not allow a regular user to access the page" do
sign_in(create(:user))
get :index
expect(response).to have_gitlab_http_status(404)
end
context 'with pending_delete projects' do
render_views
......
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