[#247] add some api specs

This commit is contained in:
Alexander Machehin 2014-11-26 14:59:21 +05:00
parent 212eb66a9e
commit 697433eef5
2 changed files with 17 additions and 1 deletions

View File

@ -51,6 +51,18 @@ shared_examples_for 'create build list via api' do
it 'should not create without existing commit hash in project' do
lambda{ post :create, @create_params.deep_merge(build_list: {commit_hash: 'wrong'})}.should change{@project.build_lists.count}.by(0)
end
it 'should not create without existing arch' do
lambda{ post :create, @create_params.deep_merge(build_list: {arch_id: -1})}.should change{@project.build_lists.count}.by(0)
end
it 'should not create without existing save_to_platform' do
lambda{ post :create, @create_params.deep_merge(build_list: {save_to_platform_id: -1})}.should change{@project.build_lists.count}.by(0)
end
it 'should not create without existing save_to_repository' do
lambda{ post :create, @create_params.deep_merge(build_list: {save_to_repository_id: -1})}.should change{@project.build_lists.count}.by(0)
end
end
shared_examples_for 'not create build list via api' do

View File

@ -120,6 +120,10 @@ shared_examples_for 'api projects user with admin rights' do
get :members, id: @project.id, format: :json
response.should be_success
end
it 'should not set a wrong maintainer_id' do
put :update, project: { maintainer_id: -1 }, id: @project.id, format: :json
response.should_not be_success
end
context 'api project user with update rights' do
before do
@ -129,7 +133,7 @@ shared_examples_for 'api projects user with admin rights' do
it 'should be able to perform update action' do
response.should be_success
end
it 'ensures that group has been updated' do
it 'ensures that description has been updated' do
@project.reload
@project.description.should == 'new description'
end