2011-03-10 11:35:46 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
shared_examples_for 'projects user with reader rights' do
|
|
|
|
|
|
|
|
it 'should be able to fork project' do
|
2014-03-19 07:19:03 +00:00
|
|
|
post :fork, name_with_owner: @project.name_with_owner
|
2015-04-06 23:10:21 +01:00
|
|
|
expect(response).to redirect_to(project_path(Project.last))
|
2012-09-06 11:53:03 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'should be able to fork project to their group' do
|
|
|
|
group = FactoryGirl.create(:group)
|
2014-03-18 09:31:01 +00:00
|
|
|
create_actor_relation(group, @user, 'admin')
|
2015-04-06 23:10:21 +01:00
|
|
|
expect do
|
|
|
|
post :fork, name_with_owner: @project.name_with_owner, group: group.id
|
|
|
|
end.to change(Project, :count).by(1)
|
2012-09-06 11:53:03 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'should be able to fork project to own group' do
|
2014-01-21 04:51:49 +00:00
|
|
|
group = FactoryGirl.create(:group, owner: @user)
|
2015-04-06 23:10:21 +01:00
|
|
|
expect do
|
|
|
|
post :fork, name_with_owner: @project.name_with_owner, group: group.id
|
|
|
|
end.to change(Project, :count).by(1)
|
2012-09-06 11:53:03 +01:00
|
|
|
end
|
|
|
|
|
2013-11-19 11:02:05 +00:00
|
|
|
it 'should be able to fork project with different name' do
|
2014-03-19 07:19:03 +00:00
|
|
|
post :fork, name_with_owner: @project.name_with_owner, fork_name: 'another_name'
|
2015-04-06 23:10:21 +01:00
|
|
|
expect(response).to redirect_to(project_path(Project.where(name: 'another_name').last))
|
2013-11-19 11:02:05 +00:00
|
|
|
end
|
2012-09-06 11:53:03 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
shared_examples_for 'projects user with project admin rights' do
|
|
|
|
it 'should be able to perform update action' do
|
2014-03-19 07:19:03 +00:00
|
|
|
put :update, { name_with_owner: @project.name_with_owner }.merge(@update_params)
|
2015-04-06 23:10:21 +01:00
|
|
|
expect(response).to redirect_to(project_path(@project))
|
2012-09-06 11:53:03 +01:00
|
|
|
end
|
2014-02-18 19:26:49 +00:00
|
|
|
it 'should be able to perform schedule action' do
|
2014-03-19 07:19:03 +00:00
|
|
|
put :schedule, { name_with_owner: @project.name_with_owner }.merge(repository_id: @project.repositories.first.id)
|
2015-04-06 23:10:21 +01:00
|
|
|
expect(response).to be_success
|
2014-02-18 19:26:49 +00:00
|
|
|
end
|
2015-01-26 13:52:09 +00:00
|
|
|
|
|
|
|
it 'should be able to create alias for a project' do
|
|
|
|
post :alias, name_with_owner: @project.name_with_owner, fork_name: (@project.name + '_new')
|
2015-04-06 23:10:21 +01:00
|
|
|
expect(response).to redirect_to(project_path(Project.last))
|
2015-01-26 13:52:09 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'should create alias for a project' do
|
2015-04-06 23:10:21 +01:00
|
|
|
expect do
|
|
|
|
post :alias, name_with_owner: @project.name_with_owner, fork_name: (@project.name + '_new')
|
|
|
|
end.to change(Project, :count).by(1)
|
2015-01-26 13:52:09 +00:00
|
|
|
end
|
2012-09-06 11:53:03 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
shared_examples_for 'user with destroy rights' do
|
|
|
|
it 'should be able to perform destroy action' do
|
2014-03-19 07:19:03 +00:00
|
|
|
delete :destroy, { name_with_owner: @project.name_with_owner }
|
2015-04-06 23:10:21 +01:00
|
|
|
expect(response).to redirect_to(@project.owner)
|
2012-09-06 11:53:03 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'should change objects count on destroy' do
|
2015-04-06 23:10:21 +01:00
|
|
|
expect do
|
|
|
|
delete :destroy, name_with_owner: @project.name_with_owner
|
|
|
|
end.to change(Project, :count).by(-1)
|
2012-09-06 11:53:03 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
shared_examples_for 'projects user without project admin rights' do
|
|
|
|
it 'should not be able to edit project' do
|
|
|
|
description = @project.description
|
2014-03-19 07:19:03 +00:00
|
|
|
put :update, project: { description:"hack" }, name_with_owner: @project.name_with_owner
|
2015-04-06 23:10:21 +01:00
|
|
|
expect(@project.reload.description).to eq description
|
|
|
|
expect(response).to redirect_to(forbidden_path)
|
2012-09-06 11:53:03 +01:00
|
|
|
end
|
|
|
|
|
2014-02-18 19:26:49 +00:00
|
|
|
it 'should not be able to perform schedule action' do
|
2014-03-19 07:19:03 +00:00
|
|
|
put :schedule, { name_with_owner: @project.name_with_owner }.merge(repository_id: @project.repositories.first.id)
|
2015-04-06 23:10:21 +01:00
|
|
|
expect(response).to redirect_to(forbidden_path)
|
2014-02-18 19:26:49 +00:00
|
|
|
end
|
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
it 'should not be able to edit project sections' do
|
|
|
|
has_wiki, has_issues = @project.has_wiki, @project.has_issues
|
2014-03-19 07:19:03 +00:00
|
|
|
post :sections, project: { has_wiki: !has_wiki, has_issues: !has_issues }, name_with_owner: @project.name_with_owner
|
2015-04-06 23:10:21 +01:00
|
|
|
expect(@project.reload.has_wiki).to eq has_wiki
|
|
|
|
expect(@project.has_issues).to eq has_issues
|
|
|
|
expect(response).to redirect_to(forbidden_path)
|
2012-09-06 11:53:03 +01:00
|
|
|
end
|
2013-05-07 19:07:03 +01:00
|
|
|
|
|
|
|
it 'writer group should be able to fork project to their group' do
|
|
|
|
group = FactoryGirl.create(:group)
|
2014-03-18 09:31:01 +00:00
|
|
|
create_actor_relation(group, @user, 'writer')
|
2015-04-06 23:10:21 +01:00
|
|
|
expect do
|
|
|
|
post :fork, name_with_owner: @project.name_with_owner, group: group.id
|
|
|
|
end.to change(Project, :count).by(1)
|
2013-05-07 19:07:03 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'reader group should not be able to fork project to their group' do
|
|
|
|
group = FactoryGirl.create(:group)
|
2014-03-18 09:31:01 +00:00
|
|
|
create_actor_relation(group, @user, 'reader')
|
2015-04-06 23:10:21 +01:00
|
|
|
expect do
|
|
|
|
post :fork, name_with_owner: @project.name_with_owner, group: group.id
|
|
|
|
end.to_not change(Project, :count)
|
2013-05-07 19:07:03 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'writer group should be able to create project to their group' do
|
|
|
|
group = FactoryGirl.create(:group)
|
2014-03-21 09:49:57 +00:00
|
|
|
create_actor_relation(group, @user, 'writer')
|
2015-04-06 23:10:21 +01:00
|
|
|
expect do
|
|
|
|
post :create, @create_params.merge(who_owns: 'group', owner_id: group.id)
|
|
|
|
end.to change(Project, :count).by(1)
|
2013-05-07 19:07:03 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'reader group should not be able to create project to their group' do
|
|
|
|
group = FactoryGirl.create(:group)
|
2014-03-18 09:31:01 +00:00
|
|
|
create_actor_relation(group, @user, 'reader')
|
2015-04-06 23:10:21 +01:00
|
|
|
expect do
|
|
|
|
post :create, @create_params.merge(who_owns: 'group', owner_id: group.id)
|
|
|
|
end.to_not change(Project, :count)
|
2013-05-07 19:07:03 +01:00
|
|
|
end
|
2015-01-26 13:52:09 +00:00
|
|
|
|
|
|
|
it 'should not be able to create alias for a project' do
|
|
|
|
post :alias, name_with_owner: @project.name_with_owner
|
2015-04-06 23:10:21 +01:00
|
|
|
expect(response).to redirect_to(forbidden_path)
|
2015-01-26 13:52:09 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'should not create alias for a project' do
|
2015-04-06 23:10:21 +01:00
|
|
|
expect do
|
|
|
|
post :alias, name_with_owner: @project.name_with_owner, fork_name: (@project.name + '_new')
|
|
|
|
end.to_not change(Project, :count)
|
2015-01-26 13:52:09 +00:00
|
|
|
end
|
2012-09-06 11:53:03 +01:00
|
|
|
end
|
|
|
|
|
2015-02-19 01:12:08 +00:00
|
|
|
describe Projects::ProjectsController, type: :controller do
|
2012-04-10 10:40:38 +01:00
|
|
|
|
|
|
|
before(:each) do
|
2012-05-16 16:29:28 +01:00
|
|
|
stub_symlink_methods
|
2011-12-12 07:51:39 +00:00
|
|
|
|
2012-03-29 21:34:22 +01:00
|
|
|
@project = FactoryGirl.create(:project)
|
2012-09-06 11:53:03 +01:00
|
|
|
|
2014-01-21 04:51:49 +00:00
|
|
|
@create_params = {project: {name: 'pro'}}
|
|
|
|
@update_params = {project: {description: 'pro2'}}
|
2012-09-06 11:53:03 +01:00
|
|
|
|
|
|
|
@user = FactoryGirl.create(:user)
|
|
|
|
set_session_for(@user)
|
2012-04-10 10:40:38 +01:00
|
|
|
end
|
2011-03-10 11:35:46 +00:00
|
|
|
|
2013-05-07 19:07:03 +01:00
|
|
|
context 'for users' do
|
2011-11-24 19:22:37 +00:00
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
context 'guest' do
|
2011-11-24 19:22:37 +00:00
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
before(:each) do
|
|
|
|
set_session_for(User.new)
|
|
|
|
end
|
2011-11-24 19:22:37 +00:00
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
it 'should not be able to perform index action' do
|
|
|
|
get :index
|
2015-04-06 23:10:21 +01:00
|
|
|
expect(response).to redirect_to(new_user_session_path)
|
2012-09-06 11:53:03 +01:00
|
|
|
end
|
2011-11-24 19:22:37 +00:00
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
it 'should not be able to perform update action' do
|
2014-03-19 07:19:03 +00:00
|
|
|
put :update, { name_with_owner: @project.name_with_owner }.merge(@update_params)
|
2015-04-06 23:10:21 +01:00
|
|
|
expect(response).to redirect_to(new_user_session_path)
|
2012-09-06 11:53:03 +01:00
|
|
|
end
|
2012-11-22 11:23:04 +00:00
|
|
|
|
2014-02-18 19:26:49 +00:00
|
|
|
it 'should not be able to perform schedule action' do
|
2014-03-19 07:19:03 +00:00
|
|
|
put :schedule, { name_with_owner: @project.name_with_owner }.merge(repository_id: @project.repositories.first.id)
|
2015-04-06 23:10:21 +01:00
|
|
|
expect(response).to redirect_to(new_user_session_path)
|
2014-02-18 19:26:49 +00:00
|
|
|
end
|
|
|
|
|
2012-11-22 11:23:04 +00:00
|
|
|
it 'should not be able to perform create action' do
|
|
|
|
post :create, @create_params
|
2015-04-06 23:10:21 +01:00
|
|
|
expect(response).to redirect_to(new_user_session_path)
|
2012-11-22 11:23:04 +00:00
|
|
|
end
|
2011-11-24 19:22:37 +00:00
|
|
|
end
|
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
context 'registered user' do
|
2011-11-24 19:22:37 +00:00
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
it 'should be able to perform index action' do
|
|
|
|
get :index
|
2015-04-06 23:10:21 +01:00
|
|
|
expect(response).to render_template(:index)
|
2012-09-06 11:53:03 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'create project for myself' do
|
2014-01-21 04:51:49 +00:00
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
it 'should be able to perform create action' do
|
|
|
|
post :create, @create_params
|
2015-04-06 23:10:21 +01:00
|
|
|
expect(response).to redirect_to(project_path( Project.last ))
|
2012-09-06 11:53:03 +01:00
|
|
|
end
|
2011-11-24 19:22:37 +00:00
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
it 'should create project in the database' do
|
2015-04-06 23:10:21 +01:00
|
|
|
expect do
|
|
|
|
post :create, @create_params
|
|
|
|
end.to change(Project, :count).by(1)
|
2012-09-06 11:53:03 +01:00
|
|
|
end
|
|
|
|
end
|
2011-11-25 16:23:10 +00:00
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
context 'create project for group' do
|
2011-11-25 16:23:10 +00:00
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
it 'should not be able to create project for alien group' do
|
|
|
|
group = FactoryGirl.create(:group)
|
2014-01-21 04:51:49 +00:00
|
|
|
post :create, @create_params.merge({who_owns: 'group', owner_id: group.id})
|
2015-04-06 23:10:21 +01:00
|
|
|
expect(response).to redirect_to(forbidden_path)
|
2012-09-06 11:53:03 +01:00
|
|
|
end
|
2011-11-29 14:36:51 +00:00
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
it 'should be able to create project for their group' do
|
|
|
|
group = FactoryGirl.create(:group)
|
2014-03-18 09:31:01 +00:00
|
|
|
create_actor_relation(group, @user, 'admin')
|
2015-04-06 23:10:21 +01:00
|
|
|
expect do
|
|
|
|
post :create, @create_params.merge({who_owns: 'group', owner_id: group.id})
|
|
|
|
end.to change(Project, :count).by(1)
|
2012-09-06 11:53:03 +01:00
|
|
|
end
|
2012-04-10 10:40:38 +01:00
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
it 'should be able to create project for own group' do
|
2014-01-21 04:51:49 +00:00
|
|
|
group = FactoryGirl.create(:group, owner: @user)
|
2015-04-06 23:10:21 +01:00
|
|
|
expect do
|
|
|
|
post :create, @create_params.merge({who_owns: 'group', owner_id: group.id})
|
|
|
|
end.to change(Project, :count).by(1)
|
2012-09-06 11:53:03 +01:00
|
|
|
end
|
2014-01-21 04:51:49 +00:00
|
|
|
end
|
2011-11-24 19:22:37 +00:00
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
end # context 'registered user'
|
2013-05-07 19:07:03 +01:00
|
|
|
end # context 'for users'
|
2011-11-24 19:22:37 +00:00
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
context 'for project members' do
|
2011-11-24 19:22:37 +00:00
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
context 'for global admin' do
|
|
|
|
before(:each) do
|
|
|
|
@user.role = "admin"
|
|
|
|
@user.save
|
|
|
|
set_session_for(@user)
|
|
|
|
end
|
2012-04-09 18:56:03 +01:00
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
it_should_behave_like 'projects user with project admin rights'
|
|
|
|
it_should_behave_like 'projects user with reader rights'
|
|
|
|
it_should_behave_like 'user with destroy rights'
|
2012-04-10 10:40:38 +01:00
|
|
|
|
2012-04-09 18:56:03 +01:00
|
|
|
end
|
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
context 'for owner user' do
|
|
|
|
before(:each) do
|
|
|
|
@user = @project.owner
|
|
|
|
set_session_for(@user) # owner should be user
|
|
|
|
end
|
|
|
|
|
|
|
|
it_should_behave_like 'projects user with project admin rights'
|
|
|
|
it_should_behave_like 'projects user with reader rights'
|
|
|
|
it_should_behave_like 'user with destroy rights'
|
|
|
|
|
|
|
|
it 'should not be able to fork own project' do
|
2014-03-19 07:19:03 +00:00
|
|
|
post :fork, name_with_owner: @project.name_with_owner
|
2015-04-06 23:10:21 +01:00
|
|
|
expect(response).to redirect_to(@project)
|
2012-09-06 11:53:03 +01:00
|
|
|
end
|
2011-12-16 00:33:44 +00:00
|
|
|
|
|
|
|
end
|
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
context 'for reader user' do
|
|
|
|
before(:each) do
|
2014-03-18 09:31:01 +00:00
|
|
|
create_relation(@project, @user, 'reader')
|
2012-09-06 11:53:03 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
it_should_behave_like 'projects user with reader rights'
|
|
|
|
it_should_behave_like 'projects user without project admin rights'
|
2011-12-16 00:33:44 +00:00
|
|
|
end
|
2012-04-10 10:40:38 +01:00
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
context 'for writer user' do
|
|
|
|
before(:each) do
|
2014-03-18 09:31:01 +00:00
|
|
|
create_relation(@project, @user, 'writer')
|
2012-09-06 11:53:03 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
it_should_behave_like 'projects user with reader rights'
|
|
|
|
it_should_behave_like 'projects user without project admin rights'
|
|
|
|
|
2012-05-15 11:36:36 +01:00
|
|
|
end
|
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
context 'for other user' do
|
|
|
|
|
|
|
|
it 'should not be able to fork hidden project' do
|
2014-01-21 04:51:49 +00:00
|
|
|
@project.update_attributes(visibility: 'hidden')
|
2014-03-19 07:19:03 +00:00
|
|
|
post :fork, name_with_owner: @project.name_with_owner
|
2015-04-06 23:10:21 +01:00
|
|
|
expect(response).to redirect_to(forbidden_path)
|
2012-09-06 11:53:03 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
it_should_behave_like 'projects user without project admin rights'
|
|
|
|
|
2012-04-10 10:40:38 +01:00
|
|
|
end
|
2012-05-15 11:36:36 +01:00
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
end # context 'for project members'
|
2012-05-15 11:36:36 +01:00
|
|
|
|
2012-06-19 19:24:35 +01:00
|
|
|
context 'for group' do
|
|
|
|
before(:each) do
|
|
|
|
@group = FactoryGirl.create(:group)
|
|
|
|
end
|
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
context 'group is owner of the project' do
|
2012-06-19 19:24:35 +01:00
|
|
|
before(:each) do
|
2014-01-21 04:51:49 +00:00
|
|
|
@project = FactoryGirl.create(:project, owner: @group)
|
2012-06-19 19:24:35 +01:00
|
|
|
end
|
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
context 'group member user with reader role' do
|
2014-03-18 09:31:01 +00:00
|
|
|
before(:each) { create_actor_relation(@group, @user, 'reader') }
|
2012-06-19 19:24:35 +01:00
|
|
|
|
|
|
|
it_should_behave_like 'projects user with reader rights'
|
2012-09-06 11:53:03 +01:00
|
|
|
it_should_behave_like 'projects user without project admin rights'
|
2012-06-19 19:24:35 +01:00
|
|
|
|
|
|
|
it 'should has reader role to group project' do
|
2015-04-06 23:10:21 +01:00
|
|
|
expect(@user.best_role(@project)).to eq 'reader'
|
2012-06-19 19:24:35 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'user should has best role' do
|
2014-03-18 09:31:01 +00:00
|
|
|
before(:each) { create_relation(@project, @user, 'admin') }
|
2012-09-06 11:53:03 +01:00
|
|
|
it_should_behave_like 'projects user with project admin rights'
|
2012-06-19 19:24:35 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
context 'group member user with admin role' do
|
2014-03-18 09:31:01 +00:00
|
|
|
before(:each) { create_actor_relation(@group, @user, 'admin') }
|
2012-06-19 19:24:35 +01:00
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
it_should_behave_like 'projects user with project admin rights'
|
2012-06-19 19:24:35 +01:00
|
|
|
it_should_behave_like 'projects user with reader rights'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
context 'group is member of the project' do
|
2012-06-19 19:24:35 +01:00
|
|
|
context 'with admin rights' do
|
2014-03-18 09:31:01 +00:00
|
|
|
before(:each) { create_relation(@project, @group, 'admin') }
|
2012-06-19 19:24:35 +01:00
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
context 'group member user with reader role' do
|
2014-03-18 09:31:01 +00:00
|
|
|
before(:each) { create_actor_relation(@group, @user, 'reader') }
|
2012-06-19 19:24:35 +01:00
|
|
|
|
|
|
|
it_should_behave_like 'projects user with reader rights'
|
2012-09-06 11:53:03 +01:00
|
|
|
it_should_behave_like 'projects user with project admin rights'
|
2012-06-19 19:24:35 +01:00
|
|
|
|
|
|
|
context 'user should has best role' do
|
2014-03-18 09:31:01 +00:00
|
|
|
before(:each) { create_relation(@project, @user, 'reader') }
|
2012-09-06 11:53:03 +01:00
|
|
|
it_should_behave_like 'projects user with project admin rights'
|
2012-06-19 19:24:35 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
context 'group member user with admin role' do
|
2014-03-18 09:31:01 +00:00
|
|
|
before(:each) { create_actor_relation(@group, @user, 'admin') }
|
2012-06-19 19:24:35 +01:00
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
it_should_behave_like 'projects user with project admin rights'
|
2012-06-19 19:24:35 +01:00
|
|
|
it_should_behave_like 'projects user with reader rights'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with reader rights' do
|
2014-03-18 09:31:01 +00:00
|
|
|
before(:each) { create_relation(@project, @group, 'reader') }
|
2012-06-19 19:24:35 +01:00
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
context 'group member user with reader role' do
|
2014-03-18 09:31:01 +00:00
|
|
|
before(:each) { create_actor_relation(@group, @user, 'reader') }
|
2012-06-19 19:24:35 +01:00
|
|
|
|
|
|
|
it_should_behave_like 'projects user with reader rights'
|
2012-09-06 11:53:03 +01:00
|
|
|
it_should_behave_like 'projects user without project admin rights'
|
2012-06-19 19:24:35 +01:00
|
|
|
|
|
|
|
context 'user should has best role' do
|
2014-03-18 09:31:01 +00:00
|
|
|
before(:each) { create_relation(@project, @user, 'admin') }
|
2012-09-06 11:53:03 +01:00
|
|
|
it_should_behave_like 'projects user with project admin rights'
|
2012-06-19 19:24:35 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-09-06 11:53:03 +01:00
|
|
|
context 'group member user with admin role' do
|
2014-03-18 09:31:01 +00:00
|
|
|
before(:each) { create_actor_relation(@group, @user, 'admin') }
|
2012-06-19 19:24:35 +01:00
|
|
|
|
|
|
|
it_should_behave_like 'projects user with reader rights'
|
2012-09-06 11:53:03 +01:00
|
|
|
it_should_behave_like 'projects user without project admin rights'
|
2012-06-19 19:24:35 +01:00
|
|
|
end
|
|
|
|
end
|
2012-05-15 11:36:36 +01:00
|
|
|
end
|
2012-04-10 10:40:38 +01:00
|
|
|
end
|
2011-03-10 11:35:46 +00:00
|
|
|
end
|