administrator dashboard for observing the Docker container pool

This commit is contained in:
Hauke Klement
2015-02-10 12:23:26 +01:00
parent 7ab57403df
commit 59ca0a57c3
10 changed files with 147 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
require 'rails_helper'
describe Admin::DashboardController do
before(:each) { allow(controller).to receive(:current_user).and_return(FactoryGirl.build(:admin)) }
describe 'GET #show' do
describe 'with format HTML' do
before(:each) { get :show }
expect_status(200)
expect_template(:show)
end
describe 'with format JSON' do
before(:each) { get :show, format: :json }
expect_json
expect_status(200)
end
end
end

View File

@@ -0,0 +1,19 @@
require 'rails_helper'
describe Admin::DashboardPolicy do
subject { Admin::DashboardPolicy }
permissions :show? do
it 'grants access to admins' do
expect(subject).to permit(FactoryGirl.build(:admin), :dashboard)
end
it 'does not grant access to teachers' do
expect(subject).not_to permit(FactoryGirl.build(:teacher), :dashboard)
end
it 'does not grant access to external users' do
expect(subject).not_to permit(FactoryGirl.build(:external_user), :dashboard)
end
end
end