#221: added specs for Platform and Repositories controller

This commit is contained in:
Vokhmin Alexey V 2013-07-17 19:33:58 +04:00
parent 90b5c59582
commit 1b314e8085
2 changed files with 31 additions and 1 deletions

View File

@ -378,6 +378,22 @@ describe Platforms::PlatformsController do
it_should_behave_like 'platform user without global admin rights'
end
context 'for member of repository' do
before do
http_login(@user)
repository = FactoryGirl.create(:repository, :platform => @platform)
repository.add_member(@user)
personal_repository = FactoryGirl.create(:repository, :platform => @personal_platform)
personal_repository.add_member(@user)
end
it_should_behave_like 'platform user with reader rights'
it_should_behave_like 'platform user with reader rights for hidden platform'
it_should_behave_like 'platform user without member rights'
it_should_behave_like 'platform user without owner rights'
it_should_behave_like 'platform user without global admin rights'
end
context 'for simple user' do
before do
http_login(@user)

View File

@ -302,7 +302,8 @@ describe Platforms::RepositoriesController do
context 'for repository member user' do
before(:each) do
[@repository, @personal_repository].each do |repo|
repo.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'admin')
# repo.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'admin')
repo.add_member @user
end
end
@ -311,6 +312,19 @@ describe Platforms::RepositoriesController do
let(:redirect_path) { forbidden_path }
it_should_behave_like 'registered user or guest'
it_should_behave_like 'user with change projects in repository rights'
context 'for hidden platform' do
before do
@platform.update_column(:visibility, 'hidden')
@personal_repository.platform.update_column(:visibility, 'hidden')
end
it_should_behave_like 'registered user'
let(:redirect_path) { forbidden_path }
it_should_behave_like 'registered user or guest'
it_should_behave_like 'user with change projects in repository rights'
end
end
end