#345: updated hooks_controller_spec
This commit is contained in:
parent
328fbee19f
commit
19b56818a0
|
@ -2,54 +2,54 @@ require 'spec_helper'
|
|||
|
||||
shared_examples_for 'hooks user with project admin rights' do
|
||||
it 'should be able to perform index action' do
|
||||
get :index, {owner_name: @project.owner.uname, project_name: @project.name}
|
||||
get :index, {owner_with_name: "#{@project.owner.uname}/#{@project.name}"}
|
||||
response.should be_success
|
||||
end
|
||||
|
||||
it 'should be able to perform new action' do
|
||||
get :new, {owner_name: @project.owner.uname, project_name: @project.name, hook: {name: 'web'}}
|
||||
get :new, {owner_with_name: "#{@project.owner.uname}/#{@project.name}", hook: {name: 'web'}}
|
||||
response.should be_success
|
||||
end
|
||||
|
||||
it 'should be able to perform edit action' do
|
||||
get :new, {owner_name: @project.owner.uname, project_name: @project.name, id: @hook.id}
|
||||
get :new, {owner_with_name: "#{@project.owner.uname}/#{@project.name}", id: @hook.id}
|
||||
response.should be_success
|
||||
end
|
||||
|
||||
it 'should be able to perform update action' do
|
||||
put :update, {owner_name: @project.owner.uname, project_name: @project.name, id: @hook.id}.merge(@update_params)
|
||||
put :update, {owner_with_name: "#{@project.owner.uname}/#{@project.name}", id: @hook.id}.merge(@update_params)
|
||||
response.should redirect_to(project_hooks_path(@project, name: 'web'))
|
||||
end
|
||||
|
||||
it 'should be able to perform create action' do
|
||||
post :create, {owner_name: @project.owner.uname, project_name: @project.name}.merge(@create_params)
|
||||
post :create, {owner_with_name: "#{@project.owner.uname}/#{@project.name}"}.merge(@create_params)
|
||||
response.should redirect_to(project_hooks_path(@project, name: 'web'))
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'hooks user without project admin rights' do
|
||||
it 'should not be able to perform index action' do
|
||||
get :index, {owner_name: @project.owner.uname, project_name: @project.name}
|
||||
get :index, {owner_with_name: "#{@project.owner.uname}/#{@project.name}"}
|
||||
response.should redirect_to(forbidden_path)
|
||||
end
|
||||
|
||||
it 'should not be able to perform new action' do
|
||||
get :new, {owner_name: @project.owner.uname, project_name: @project.name, hook: {name: 'web'}}
|
||||
get :new, {owner_with_name: "#{@project.owner.uname}/#{@project.name}", hook: {name: 'web'}}
|
||||
response.should redirect_to(forbidden_path)
|
||||
end
|
||||
|
||||
it 'should not be able to perform edit action' do
|
||||
get :new, {owner_name: @project.owner.uname, project_name: @project.name, id: @hook.id}
|
||||
get :new, {owner_with_name: "#{@project.owner.uname}/#{@project.name}", id: @hook.id}
|
||||
response.should redirect_to(forbidden_path)
|
||||
end
|
||||
|
||||
it 'should not be able to perform update action' do
|
||||
put :update, {owner_name: @project.owner.uname, project_name: @project.name, id: @hook.id}.merge(@update_params)
|
||||
put :update, {owner_with_name: "#{@project.owner.uname}/#{@project.name}", id: @hook.id}.merge(@update_params)
|
||||
response.should redirect_to(forbidden_path)
|
||||
end
|
||||
|
||||
it 'should not be able to perform create action' do
|
||||
post :create, {owner_name: @project.owner.uname, project_name: @project.name}.merge(@create_params)
|
||||
post :create, {owner_with_name: "#{@project.owner.uname}/#{@project.name}"}.merge(@create_params)
|
||||
response.should redirect_to(forbidden_path)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue