ability_test.rb revision f1304db188bff0f7c40172819863ffe54401b400
require 'test_helper'
context 'Repository' do
setup do
end
context 'guest' do
setup do
end
should 'not be allowed: new, create' do
end
end
should 'not be allowed: new, create' do
end
end
end
context 'owner' do
setup do
end
should 'be allowed: new, create' do
end
end
should 'be allowed: edit, update, destroy, permissions, write' do
end
end
should 'not be allowed on other: edit, update, destroy, permissions' do
end
end
end
context 'editor' do
setup do
end
should 'be allowed: write' do
end
end
should 'not be allowed: edit, update, destroy, permissions' do
end
end
end
end
context 'Team' do
setup do
@memberteam.users << @user
end
context 'admin' do
should 'be allowed: edit, update, destroy' do
end
end
end
context 'member' do
should 'be allowed: create, show, index' do
end
end
should 'not be allowed: edit, update, destroy (without admin on team)' do
end
end
should 'not be allowed: edit, update, destroy (without being on team)' do
end
end
end
end
context 'Comment' do
setup do
end
context 'author' do
setup do
end
should 'destroy his own comment' do
end
should 'not be allowed to destroy others comment' do
end
end
context 'admin' do
setup do
end
should 'destroy others comment' do
end
end
context 'comments repository owner' do
setup do
FactoryGirl.create(:permission, subject: @owner, role: 'owner', item: @comment.commentable.repository)
end
should 'destroy others comments for his repository' do
end
end
context 'comments repository editor' do
setup do
FactoryGirl.create(:permission, subject: @owner, role: 'editor', item: @comment.commentable.repository)
end
should 'not destroy others comments for his repository' do
end
end
end
end