transferred Code Ocean from original repository to GitHub

This commit is contained in:
Hauke Klement
2015-01-22 09:51:49 +01:00
commit 4cbf9970b1
683 changed files with 11979 additions and 0 deletions

View File

@ -0,0 +1,34 @@
require 'rails_helper'
describe 'Authorization' do
context 'as an admin' do
let(:user) { FactoryGirl.create(:admin) }
before(:each) { allow_any_instance_of(ApplicationController).to receive(:current_user).and_return(user) }
%w[consumer execution_environment exercise file_type internal_user].each do |model|
expect_permitted_path(:"new_#{model}_path")
end
end
context 'as an external user' do
let(:user) { FactoryGirl.create(:external_user) }
before(:each) { allow_any_instance_of(ApplicationController).to receive(:current_user).and_return(user) }
%w[consumer execution_environment exercise file_type internal_user].each do |model|
expect_forbidden_path(:"new_#{model}_path")
end
end
context 'as a teacher' do
let(:user) { FactoryGirl.create(:teacher) }
before(:each) { allow_any_instance_of(ApplicationController).to receive(:current_user).and_return(user) }
%w[consumer internal_user].each do |model|
expect_forbidden_path(:"new_#{model}_path")
end
%w[execution_environment exercise file_type].each do |model|
expect_permitted_path(:"new_#{model}_path")
end
end
end