#319: added specs for #add_projects and #remove_projects methods

This commit is contained in:
Vokhmin Alexey V 2013-11-12 16:24:25 +04:00
parent a7e908b102
commit 900f1f6143
1 changed files with 25 additions and 0 deletions

View File

@ -107,4 +107,29 @@ describe Repository do
end
context '#add_projects' do
it 'user has ability to read of adding project' do
repository = FactoryGirl.create(:repository)
project = FactoryGirl.create(:project)
repository.add_projects("#{project.owner.uname}/#{project.name}", FactoryGirl.create(:user))
repository.projects.should have(1).item
end
it 'user has no ability to read of adding project' do
repository = FactoryGirl.create(:repository)
project = FactoryGirl.create(:project, :visibility => 'hidden')
repository.add_projects("#{project.owner.uname}/#{project.name}", FactoryGirl.create(:user))
repository.projects.should have(:no).items
end
end
it '#remove_projects' do
repository = FactoryGirl.create(:repository)
project = FactoryGirl.create(:project)
repository.projects << project
repository.remove_projects(project.name)
repository.reload
repository.projects.should have(:no).items
end
end