From 257c400a9b85a80d2348983eb735d25dc63d1c5b Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Wed, 19 Mar 2014 16:34:30 +0600 Subject: [PATCH] [#345] fix api specs --- .../api/v1/build_lists_controller_spec.rb | 2 +- .../controllers/api/v1/groups_controller_spec.rb | 16 ++++++++-------- .../api/v1/platforms_controller_spec.rb | 12 ++++++------ .../api/v1/projects_controller_spec.rb | 16 ++++++++-------- .../api/v1/repositories_controller_spec.rb | 12 ++++++------ spec/controllers/api/v1/users_controller_spec.rb | 8 ++++---- 6 files changed, 33 insertions(+), 33 deletions(-) diff --git a/spec/controllers/api/v1/build_lists_controller_spec.rb b/spec/controllers/api/v1/build_lists_controller_spec.rb index 32bdb8f0a..31db6f95f 100644 --- a/spec/controllers/api/v1/build_lists_controller_spec.rb +++ b/spec/controllers/api/v1/build_lists_controller_spec.rb @@ -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) diff --git a/spec/controllers/api/v1/groups_controller_spec.rb b/spec/controllers/api/v1/groups_controller_spec.rb index d7a2f9e2c..f6ef4cbcf 100644 --- a/spec/controllers/api/v1/groups_controller_spec.rb +++ b/spec/controllers/api/v1/groups_controller_spec.rb @@ -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 diff --git a/spec/controllers/api/v1/platforms_controller_spec.rb b/spec/controllers/api/v1/platforms_controller_spec.rb index 8120589d6..4263260e3 100644 --- a/spec/controllers/api/v1/platforms_controller_spec.rb +++ b/spec/controllers/api/v1/platforms_controller_spec.rb @@ -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 diff --git a/spec/controllers/api/v1/projects_controller_spec.rb b/spec/controllers/api/v1/projects_controller_spec.rb index 12fb2b186..088a0f5c0 100644 --- a/spec/controllers/api/v1/projects_controller_spec.rb +++ b/spec/controllers/api/v1/projects_controller_spec.rb @@ -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 diff --git a/spec/controllers/api/v1/repositories_controller_spec.rb b/spec/controllers/api/v1/repositories_controller_spec.rb index 5b12f4e45..269b4ef88 100644 --- a/spec/controllers/api/v1/repositories_controller_spec.rb +++ b/spec/controllers/api/v1/repositories_controller_spec.rb @@ -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 diff --git a/spec/controllers/api/v1/users_controller_spec.rb b/spec/controllers/api/v1/users_controller_spec.rb index 174b1ebfb..bf0e370ed 100644 --- a/spec/controllers/api/v1/users_controller_spec.rb +++ b/spec/controllers/api/v1/users_controller_spec.rb @@ -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