[#345] fix api specs
This commit is contained in:
parent
9e1c03f5ea
commit
257c400a9b
|
@ -733,7 +733,7 @@ describe Api::V1::BuildListsController do
|
|||
end
|
||||
|
||||
it 'should show only accessible build_lists' do
|
||||
get :index, filter: {ownership: 'index'}, format: :json
|
||||
get :index, filter: ownership: 'index', format: :json
|
||||
assigns(:build_lists).should include(@build_list1)
|
||||
assigns(:build_lists).should_not include(@build_list2)
|
||||
assigns(:build_lists).should include(@build_list3)
|
||||
|
|
|
@ -31,7 +31,7 @@ shared_examples_for 'api group user with admin rights' do
|
|||
|
||||
context 'api group user with update rights' do
|
||||
before do
|
||||
put :update, {group: {description: 'new description'}, id: @group.id}, format: :json
|
||||
put :update, group: {description: 'new description'}, id: @group.id, format: :json
|
||||
end
|
||||
|
||||
it 'should be able to perform update action' do
|
||||
|
@ -46,7 +46,7 @@ shared_examples_for 'api group user with admin rights' do
|
|||
context 'api group user with add_member rights' do
|
||||
let(:member) { FactoryGirl.create(:user) }
|
||||
before do
|
||||
put :add_member, {member_id: member.id, id: @group.id}, format: :json
|
||||
put :add_member, member_id: member.id, id: @group.id, format: :json
|
||||
end
|
||||
|
||||
it 'should be able to perform add_member action' do
|
||||
|
@ -61,7 +61,7 @@ shared_examples_for 'api group user with admin rights' do
|
|||
let(:member) { FactoryGirl.create(:user) }
|
||||
before do
|
||||
@group.add_member(member)
|
||||
delete :remove_member, {member_id: member.id, id: @group.id}, format: :json
|
||||
delete :remove_member, member_id: member.id, id: @group.id, format: :json
|
||||
end
|
||||
|
||||
it 'should be able to perform remove_member action' do
|
||||
|
@ -76,7 +76,7 @@ shared_examples_for 'api group user with admin rights' do
|
|||
let(:member) { FactoryGirl.create(:user) }
|
||||
before do
|
||||
@group.add_member(member)
|
||||
put :update_member, {member_id: member.id, role: 'reader', id: @group.id}, format: :json
|
||||
put :update_member, member_id: member.id, role: 'reader', id: @group.id, format: :json
|
||||
end
|
||||
|
||||
it 'should be able to perform update_member action' do
|
||||
|
@ -106,7 +106,7 @@ shared_examples_for 'api group user without admin rights' do
|
|||
let(:member) { FactoryGirl.create(:user) }
|
||||
before do
|
||||
@group.add_member(member)
|
||||
put :update_member, {member_id: member.id, role: 'reader', id: @group.id}, format: :json
|
||||
put :update_member, member_id: member.id, role: 'reader', id: @group.id, format: :json
|
||||
end
|
||||
|
||||
it 'should not be able to perform update_member action' do
|
||||
|
@ -120,7 +120,7 @@ shared_examples_for 'api group user without admin rights' do
|
|||
|
||||
context 'api group user without update rights' do
|
||||
before do
|
||||
put :update, {group: {description: 'new description'}, id: @group.id}, format: :json
|
||||
put :update, group: {description: 'new description'}, id: @group.id, format: :json
|
||||
end
|
||||
|
||||
it 'should not be able to perform update action' do
|
||||
|
@ -135,7 +135,7 @@ shared_examples_for 'api group user without admin rights' do
|
|||
context 'api group user without add_member rights' do
|
||||
let(:member) { FactoryGirl.create(:user) }
|
||||
before do
|
||||
put :add_member, {member_id: member.id, id: @group.id}, format: :json
|
||||
put :add_member, member_id: member.id, id: @group.id, format: :json
|
||||
end
|
||||
|
||||
it 'should not be able to perform add_member action' do
|
||||
|
@ -150,7 +150,7 @@ shared_examples_for 'api group user without admin rights' do
|
|||
let(:member) { FactoryGirl.create(:user) }
|
||||
before do
|
||||
@group.add_member(member)
|
||||
delete :remove_member, {member_id: member.id, id: @group.id}, format: :json
|
||||
delete :remove_member, member_id: member.id, id: @group.id, format: :json
|
||||
end
|
||||
|
||||
it 'should be able to perform update action' do
|
||||
|
|
|
@ -18,7 +18,7 @@ shared_examples_for 'api platform user with owner rights' do
|
|||
|
||||
context 'api platform user with update rights' do
|
||||
before do
|
||||
put :update, {platform: {description: 'new description'}, id: @platform.id}, format: :json
|
||||
put :update, platform: { description: 'new description' }, id: @platform.id, format: :json
|
||||
end
|
||||
|
||||
it 'should be able to perform update action' do
|
||||
|
@ -51,7 +51,7 @@ end
|
|||
shared_examples_for 'api platform user without owner rights' do
|
||||
context 'api platform user without update rights' do
|
||||
before do
|
||||
put :update, {platform: {description: 'new description'}, id: @platform.id}, format: :json
|
||||
put :update, platform: { description: 'new description' }, id: @platform.id, format: :json
|
||||
end
|
||||
|
||||
it 'should not be able to perform update action' do
|
||||
|
@ -87,7 +87,7 @@ shared_examples_for 'api platform user with member rights' do
|
|||
context 'api platform user with add_member rights' do
|
||||
let(:member) { FactoryGirl.create(:user) }
|
||||
before do
|
||||
put :add_member, {member_id: member.id, type: 'User', id: @platform.id}, format: :json
|
||||
put :add_member, member_id: member.id, type: 'User', id: @platform.id, format: :json
|
||||
end
|
||||
|
||||
it 'should be able to perform add_member action' do
|
||||
|
@ -102,7 +102,7 @@ shared_examples_for 'api platform user with member rights' do
|
|||
let(:member) { FactoryGirl.create(:user) }
|
||||
before do
|
||||
@platform.add_member(member)
|
||||
delete :remove_member, {member_id: member.id, type: 'User', id: @platform.id}, format: :json
|
||||
delete :remove_member, member_id: member.id, type: 'User', id: @platform.id, format: :json
|
||||
end
|
||||
|
||||
it 'should be able to perform remove_member action' do
|
||||
|
@ -120,7 +120,7 @@ shared_examples_for 'api platform user without member rights' do
|
|||
context 'api platform user without add_member rights' do
|
||||
let(:member) { FactoryGirl.create(:user) }
|
||||
before do
|
||||
put :add_member, {member_id: member.id, type: 'User', id: @platform.id}, format: :json
|
||||
put :add_member, member_id: member.id, type: 'User', id: @platform.id, format: :json
|
||||
end
|
||||
|
||||
it 'should not be able to perform add_member action' do
|
||||
|
@ -135,7 +135,7 @@ shared_examples_for 'api platform user without member rights' do
|
|||
let(:member) { FactoryGirl.create(:user) }
|
||||
before do
|
||||
@platform.add_member(member)
|
||||
delete :remove_member, {member_id: member.id, type: 'User', id: @platform.id}, format: :json
|
||||
delete :remove_member, member_id: member.id, type: 'User', id: @platform.id, format: :json
|
||||
end
|
||||
|
||||
it 'should be able to perform update action' do
|
||||
|
|
|
@ -123,7 +123,7 @@ shared_examples_for 'api projects user with admin rights' do
|
|||
|
||||
context 'api project user with update rights' do
|
||||
before do
|
||||
put :update, {project: {description: 'new description'}, id: @project.id}, format: :json
|
||||
put :update, project: { description: 'new description' }, id: @project.id, format: :json
|
||||
end
|
||||
|
||||
it 'should be able to perform update action' do
|
||||
|
@ -138,7 +138,7 @@ shared_examples_for 'api projects user with admin rights' do
|
|||
context 'api project user with add_member rights' do
|
||||
let(:member) { FactoryGirl.create(:user) }
|
||||
before do
|
||||
put :add_member, {member_id: member.id, type: 'User', role: 'admin', id: @project.id}, format: :json
|
||||
put :add_member, member_id: member.id, type: 'User', role: 'admin', id: @project.id, format: :json
|
||||
end
|
||||
|
||||
it 'should be able to perform add_member action' do
|
||||
|
@ -153,7 +153,7 @@ shared_examples_for 'api projects user with admin rights' do
|
|||
let(:member) { FactoryGirl.create(:user) }
|
||||
before do
|
||||
@project.add_member(member)
|
||||
delete :remove_member, {member_id: member.id, type: 'User', id: @project.id}, format: :json
|
||||
delete :remove_member, member_id: member.id, type: 'User', id: @project.id, format: :json
|
||||
end
|
||||
|
||||
it 'should be able to perform remove_member action' do
|
||||
|
@ -168,7 +168,7 @@ shared_examples_for 'api projects user with admin rights' do
|
|||
let(:member) { FactoryGirl.create(:user) }
|
||||
before do
|
||||
@project.add_member(member)
|
||||
put :update_member, {member_id: member.id, type: 'User', role: 'reader', id: @project.id}, format: :json
|
||||
put :update_member, member_id: member.id, type: 'User', role: 'reader', id: @project.id, format: :json
|
||||
end
|
||||
|
||||
it 'should be able to perform update_member action' do
|
||||
|
@ -192,7 +192,7 @@ shared_examples_for 'api projects user without admin rights' do
|
|||
let(:member) { FactoryGirl.create(:user) }
|
||||
before do
|
||||
@project.add_member(member)
|
||||
put :update_member, {member_id: member.id, type: 'User', role: 'reader', id: @project.id}, format: :json
|
||||
put :update_member, member_id: member.id, type: 'User', role: 'reader', id: @project.id, format: :json
|
||||
end
|
||||
|
||||
it 'should not be able to perform update_member action' do
|
||||
|
@ -206,7 +206,7 @@ shared_examples_for 'api projects user without admin rights' do
|
|||
|
||||
context 'api project user without update rights' do
|
||||
before do
|
||||
put :update, {project: {description: 'new description'}, id: @project.id}, format: :json
|
||||
put :update, project: {description: 'new description'}, id: @project.id, format: :json
|
||||
end
|
||||
|
||||
it 'should not be able to perform update action' do
|
||||
|
@ -221,7 +221,7 @@ shared_examples_for 'api projects user without admin rights' do
|
|||
context 'api project user without add_member rights' do
|
||||
let(:member) { FactoryGirl.create(:user) }
|
||||
before do
|
||||
put :add_member, {member_id: member.id, type: 'User', role: 'admin', id: @project.id}, format: :json
|
||||
put :add_member, member_id: member.id, type: 'User', role: 'admin', id: @project.id, format: :json
|
||||
end
|
||||
|
||||
it 'should not be able to perform add_member action' do
|
||||
|
@ -236,7 +236,7 @@ shared_examples_for 'api projects user without admin rights' do
|
|||
let(:member) { FactoryGirl.create(:user) }
|
||||
before do
|
||||
@project.add_member(member)
|
||||
delete :remove_member, {member_id: member.id, type: 'User', id: @project.id}, format: :json
|
||||
delete :remove_member, member_id: member.id, type: 'User', id: @project.id, format: :json
|
||||
end
|
||||
|
||||
it 'should be able to perform update action' do
|
||||
|
|
|
@ -63,7 +63,7 @@ shared_examples_for 'api repository user with writer rights' do
|
|||
|
||||
context 'api repository user with update rights' do
|
||||
before do
|
||||
put :update, {repository: {description: 'new description'}, id: @repository.id}, format: :json
|
||||
put :update, repository: {description: 'new description'}, id: @repository.id, format: :json
|
||||
end
|
||||
|
||||
it 'should be able to perform update action' do
|
||||
|
@ -87,7 +87,7 @@ shared_examples_for 'api repository user with writer rights' do
|
|||
context 'api repository user with add_member rights' do
|
||||
let(:member) { FactoryGirl.create(:user) }
|
||||
before do
|
||||
put :add_member, {member_id: member.id, type: 'User', id: @repository.id}, format: :json
|
||||
put :add_member, member_id: member.id, type: 'User', id: @repository.id, format: :json
|
||||
end
|
||||
|
||||
it 'should be able to perform add_member action' do
|
||||
|
@ -102,7 +102,7 @@ shared_examples_for 'api repository user with writer rights' do
|
|||
let(:member) { FactoryGirl.create(:user) }
|
||||
before do
|
||||
@repository.add_member(member)
|
||||
delete :remove_member, {member_id: member.id, type: 'User', id: @repository.id}, format: :json
|
||||
delete :remove_member, member_id: member.id, type: 'User', id: @repository.id, format: :json
|
||||
end
|
||||
|
||||
it 'should be able to perform remove_member action' do
|
||||
|
@ -189,7 +189,7 @@ shared_examples_for 'api repository user without writer rights' do
|
|||
|
||||
context 'api repository user without update rights' do
|
||||
before do
|
||||
put :update, {repository: {description: 'new description'}, id: @repository.id}, format: :json
|
||||
put :update, repository: {description: 'new description'}, id: @repository.id, format: :json
|
||||
end
|
||||
|
||||
it 'should not be able to perform update action' do
|
||||
|
@ -213,7 +213,7 @@ shared_examples_for 'api repository user without writer rights' do
|
|||
context 'api repository user without add_member rights' do
|
||||
let(:member) { FactoryGirl.create(:user) }
|
||||
before do
|
||||
put :add_member, {member_id: member.id, type: 'User', id: @repository.id}, format: :json
|
||||
put :add_member, member_id: member.id, type: 'User', id: @repository.id, format: :json
|
||||
end
|
||||
|
||||
it 'should not be able to perform add_member action' do
|
||||
|
@ -228,7 +228,7 @@ shared_examples_for 'api repository user without writer rights' do
|
|||
let(:member) { FactoryGirl.create(:user) }
|
||||
before do
|
||||
@repository.add_member(member)
|
||||
delete :remove_member, {member_id: member.id, type: 'User', id: @repository.id}, format: :json
|
||||
delete :remove_member, member_id: member.id, type: 'User', id: @repository.id, format: :json
|
||||
end
|
||||
|
||||
it 'should be able to perform update action' do
|
||||
|
|
|
@ -28,7 +28,7 @@ describe Api::V1::UsersController do
|
|||
|
||||
context 'should not be able to perform update action for a current user' do
|
||||
before do
|
||||
put :update, {user: {company: 'test_company'}}, format: :json
|
||||
put :update, user: { company: 'test_company' }, format: :json
|
||||
end
|
||||
it { response.should_not be_success }
|
||||
it 'ensures that user has not been updated' do
|
||||
|
@ -39,7 +39,7 @@ describe Api::V1::UsersController do
|
|||
|
||||
context 'should not be able to perform notifiers action for a current user' do
|
||||
before do
|
||||
put :notifiers, {notifiers: {can_notify: false}}, format: :json
|
||||
put :notifiers, notifiers: { can_notify: false }, format: :json
|
||||
end
|
||||
it { response.should_not be_success }
|
||||
it 'ensures that user notification settings have not been updated' do
|
||||
|
@ -69,7 +69,7 @@ describe Api::V1::UsersController do
|
|||
|
||||
context 'should be able to perform update action for a current user' do
|
||||
before do
|
||||
put :update, {user: {company: 'test_company'}}, format: :json
|
||||
put :update, user: { company: 'test_company' }, format: :json
|
||||
end
|
||||
it { response.should be_success }
|
||||
it 'ensures that user has been updated' do
|
||||
|
@ -80,7 +80,7 @@ describe Api::V1::UsersController do
|
|||
|
||||
context 'should be able to perform notifiers action for a current user' do
|
||||
before do
|
||||
put :notifiers, {notifiers: {can_notify: false}}, format: :json
|
||||
put :notifiers, notifiers: {can_notify: false }, format: :json
|
||||
end
|
||||
it { response.should be_success }
|
||||
it 'ensures that user notification settings have been updated' do
|
||||
|
|
Loading…
Reference in New Issue