#354: added specs

This commit is contained in:
Vokhmin Alexey V 2014-02-18 23:26:49 +04:00
parent 95d5d7f4e5
commit c46fd937ec
1 changed files with 14 additions and 0 deletions

View File

@ -31,6 +31,10 @@ shared_examples_for 'projects user with project admin rights' do
put :update, {owner_name: @project.owner.uname, project_name: @project.name}.merge(@update_params) put :update, {owner_name: @project.owner.uname, project_name: @project.name}.merge(@update_params)
response.should redirect_to(project_path(@project)) response.should redirect_to(project_path(@project))
end end
it 'should be able to perform schedule action' do
put :schedule, {owner_name: @project.owner.uname, project_name: @project.name}.merge(repository_id: @project.repositories.first.id)
response.should be_success
end
end end
shared_examples_for 'user with destroy rights' do shared_examples_for 'user with destroy rights' do
@ -52,6 +56,11 @@ shared_examples_for 'projects user without project admin rights' do
response.should redirect_to(forbidden_path) response.should redirect_to(forbidden_path)
end end
it 'should not be able to perform schedule action' do
put :schedule, {owner_name: @project.owner.uname, project_name: @project.name}.merge(repository_id: @project.repositories.first.id)
response.should redirect_to(forbidden_path)
end
it 'should not be able to edit project sections' do it 'should not be able to edit project sections' do
has_wiki, has_issues = @project.has_wiki, @project.has_issues has_wiki, has_issues = @project.has_wiki, @project.has_issues
post :sections, project:{has_wiki: !has_wiki, has_issues: !has_issues}, owner_name: @project.owner.uname, project_name: @project.name post :sections, project:{has_wiki: !has_wiki, has_issues: !has_issues}, owner_name: @project.owner.uname, project_name: @project.name
@ -119,6 +128,11 @@ describe Projects::ProjectsController do
response.should redirect_to(new_user_session_path) response.should redirect_to(new_user_session_path)
end end
it 'should not be able to perform schedule action' do
put :schedule, {owner_name: @project.owner.uname, project_name: @project.name}.merge(repository_id: @project.repositories.first.id)
response.should redirect_to(new_user_session_path)
end
it 'should not be able to perform create action' do it 'should not be able to perform create action' do
post :create, @create_params post :create, @create_params
response.should redirect_to(new_user_session_path) response.should redirect_to(new_user_session_path)