From 4f3c9a8f3f09719e6817d5566625f5e28ad67e16 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Tue, 25 Nov 2014 00:16:51 +0300 Subject: [PATCH] #369: updated specs --- .../platforms/platforms_controller_spec.rb | 34 ++----------------- .../platforms/products_controller_spec.rb | 4 +-- .../platforms/repositories_controller_spec.rb | 20 ++--------- 3 files changed, 7 insertions(+), 51 deletions(-) diff --git a/spec/controllers/platforms/platforms_controller_spec.rb b/spec/controllers/platforms/platforms_controller_spec.rb index 440667b31..a3344818c 100644 --- a/spec/controllers/platforms/platforms_controller_spec.rb +++ b/spec/controllers/platforms/platforms_controller_spec.rb @@ -128,26 +128,11 @@ shared_examples_for 'platform user with member rights' do end end - context 'platform user with remove_member rights' do - let(:member) { FactoryGirl.create(:user) } - before do - @platform.add_member(member) - delete :remove_member, {member_id: member.id, id: @platform.id} - end - - it 'should be able to perform remove_member action' do - response.should redirect_to(members_platform_path(@platform)) - end - it 'ensures that member has been removed from platform' do - @platform.members.should_not include(member) - end - end - context 'platform user with remove_members rights' do let(:member) { FactoryGirl.create(:user) } before do @platform.add_member(member) - post :remove_members, {user_remove: {member.id => [1]}, id: @platform.id} + post :remove_members, members: [member.id], id: @platform.id end it 'should be able to perform remove_members action' do @@ -176,26 +161,11 @@ shared_examples_for 'platform user without member rights' do |guest = false| end end - context 'platform user without remove_member rights' do - let(:member) { FactoryGirl.create(:user) } - before do - @platform.add_member(member) - delete :remove_member, {member_id: member.id, id: @platform.id} - end - - it 'should not be able to perform remove_member action' do - response.should redirect_to(guest ? new_user_session_path : forbidden_path) - end - it 'ensures that member has not been removed from platform' do - @platform.members.should include(member) - end - end - context 'platform user without remove_members rights' do let(:member) { FactoryGirl.create(:user) } before do @platform.add_member(member) - post :remove_members, {user_remove: {member.id => [1]}, id: @platform.id} + post :remove_members, members: [member.id], id: @platform.id end it 'should not be able to perform remove_members action' do diff --git a/spec/controllers/platforms/products_controller_spec.rb b/spec/controllers/platforms/products_controller_spec.rb index 0aaa11d2f..70abb046a 100644 --- a/spec/controllers/platforms/products_controller_spec.rb +++ b/spec/controllers/platforms/products_controller_spec.rb @@ -30,8 +30,8 @@ describe Platforms::ProductsController do @product = FactoryGirl.create(:product, platform: @platform) @project = FactoryGirl.create(:project) - params = {platform_id: @platform, src_project: @project.name_with_owner} - @create_params = params.merge({product: {name: 'pro', time_living: 150}}) + params = {platform_id: @platform} + @create_params = params.merge({product: {name: 'pro', time_living: 150, project_id: @project.id}}) @update_params = params.merge({product: {name: 'pro2'}}) @user = FactoryGirl.create(:user) diff --git a/spec/controllers/platforms/repositories_controller_spec.rb b/spec/controllers/platforms/repositories_controller_spec.rb index 5ec103aeb..85760e056 100644 --- a/spec/controllers/platforms/repositories_controller_spec.rb +++ b/spec/controllers/platforms/repositories_controller_spec.rb @@ -95,19 +95,12 @@ shared_examples_for 'registered user or guest' do @repository.members.should_not include(@another_user) end - it 'should not be able to remove member from repository' do - create_relation(@repository, @another_user, 'admin') - delete :remove_member, id: @repository, platform_id: @platform, member_id: @another_user.id - response.should redirect_to(redirect_path) - @repository.members.should include(@another_user) - end - it 'should not be able to remove members from repository' do another_user2 = FactoryGirl.create(:user) create_relation(@repository, @another_user, 'admin') create_relation(@repository, another_user2, 'admin') post :remove_members, id: @repository, platform_id: @platform, - user_remove: {@another_user.id => [1], another_user2.id => [1]} + members: [@another_user.id, another_user2.id] response.should redirect_to(redirect_path) @repository.members.should include(@another_user, another_user2) end @@ -194,19 +187,12 @@ shared_examples_for 'platform admin user' do @repository.members.should include(@another_user) end - it 'should be able to remove member from repository' do - create_relation(@repository, @another_user, 'admin') - delete :remove_member, id: @repository, platform_id: @platform, member_id: @another_user.id - response.should redirect_to(edit_platform_repository_path(@repository.platform, @repository)) - @repository.members.should_not include(@another_user) - end - it 'should be able to remove members from repository' do another_user2 = FactoryGirl.create(:user) create_relation(@repository, @another_user, 'admin') - create_relation(@repository, @another_user2, 'admin') + create_relation(@repository, another_user2, 'admin') post :remove_members, id: @repository, platform_id: @platform, - user_remove: {@another_user.id => [1], another_user2.id => [1]} + members: [@another_user.id, another_user2.id] response.should redirect_to(edit_platform_repository_path(@repository.platform, @repository)) @repository.members.should_not include(@another_user, another_user2) end