diff options
author | Rémy Coutable <remy@rymai.me> | 2016-06-02 19:05:06 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-06-14 14:18:14 +0300 |
commit | 515205d3c1c6655302ed0ae44cc5954dead7ae79 (patch) | |
tree | 5ac24884eb0e6faf56e1e460260303fbdb14b9cf /spec/controllers | |
parent | 6d103a2f4764441b1650ba6d790732056c9a8516 (diff) |
UI and copywriting improvements
+ Move 'Edit Project/Group' out of membership-related partial
+ Show the access request buttons only to logged-in users
+ Put the request access buttons out of in a more visible button
+ Improve the copy in the #remove_member_message helper
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/groups/group_members_controller_spec.rb | 24 | ||||
-rw-r--r-- | spec/controllers/projects/project_members_controller_spec.rb | 30 |
2 files changed, 27 insertions, 27 deletions
diff --git a/spec/controllers/groups/group_members_controller_spec.rb b/spec/controllers/groups/group_members_controller_spec.rb index 0ca8a656f63..89c2c26a367 100644 --- a/spec/controllers/groups/group_members_controller_spec.rb +++ b/spec/controllers/groups/group_members_controller_spec.rb @@ -35,7 +35,7 @@ describe Groups::GroupMembersController do let(:group_user) { create(:user) } let(:member) do group.add_developer(group_user) - group.group_members.find_by(user_id: group_user.id) + group.members.find_by(user_id: group_user) end context 'when user does not have enough rights' do @@ -103,7 +103,7 @@ describe Groups::GroupMembersController do it 'removes user from members' do delete :leave, group_id: group - expect(response).to set_flash.to "You left #{group.name} group." + expect(response).to set_flash.to "You left the \"#{group.name}\" group." expect(response).to redirect_to(dashboard_groups_path) expect(group.users).not_to include user end @@ -118,8 +118,8 @@ describe Groups::GroupMembersController do it 'cannot removes himself from the group' do delete :leave, group_id: group - expect(response).to redirect_to(dashboard_groups_path) - expect(response).to set_flash[:alert].to "You can not leave #{group.name} group because you're the last owner. Transfer or delete the group." + expect(response).to redirect_to(group_path(group)) + expect(response).to set_flash[:alert].to "You can not leave the \"#{group.name}\" group. Transfer or delete the group." expect(group.users).to include user end end @@ -133,9 +133,9 @@ describe Groups::GroupMembersController do it 'removes user from members' do delete :leave, group_id: group - expect(response).to set_flash.to 'You withdrawn your access request to the group.' + expect(response).to set_flash.to 'Your access request to the group has been withdrawn.' expect(response).to redirect_to(dashboard_groups_path) - expect(group.group_members.request).to be_empty + expect(group.members.request).to be_empty expect(group.users).not_to include user end end @@ -155,18 +155,18 @@ describe Groups::GroupMembersController do expect(response).to set_flash.to 'Your request for access has been queued for review.' expect(response).to redirect_to(group_path(group)) - expect(group.group_members.request.find_by(created_by_id: user.id).created_by).to eq user + expect(group.members.request.exists?(user_id: user)).to be_truthy expect(group.users).not_to include user end end - describe '#approve' do + describe '#approve_access_request' do let(:group) { create(:group, :public) } context 'when member is not found' do it 'returns 403' do post :approve_access_request, group_id: group, - id: 42 + id: 42 expect(response.status).to eq(403) end @@ -177,7 +177,7 @@ describe Groups::GroupMembersController do let(:group_requester) { create(:user) } let(:member) do group.request_access(group_requester) - group.group_members.request.find_by(created_by_id: group_requester.id) + group.members.request.find_by(user_id: group_requester) end context 'when user does not have enough rights' do @@ -188,7 +188,7 @@ describe Groups::GroupMembersController do it 'returns 403' do post :approve_access_request, group_id: group, - id: member + id: member expect(response.status).to eq(403) expect(group.users).not_to include group_requester @@ -203,7 +203,7 @@ describe Groups::GroupMembersController do it 'adds user to members' do post :approve_access_request, group_id: group, - id: member + id: member expect(response).to redirect_to(group_group_members_path(group)) expect(group.users).to include group_requester diff --git a/spec/controllers/projects/project_members_controller_spec.rb b/spec/controllers/projects/project_members_controller_spec.rb index d3bd2d0bbba..fc5f458e795 100644 --- a/spec/controllers/projects/project_members_controller_spec.rb +++ b/spec/controllers/projects/project_members_controller_spec.rb @@ -80,7 +80,7 @@ describe Projects::ProjectMembersController do let(:team_user) { create(:user) } let(:member) do project.team << [team_user, :developer] - project.project_members.find_by(user_id: team_user.id) + project.members.find_by(user_id: team_user.id) end context 'when user does not have enough rights' do @@ -154,7 +154,7 @@ describe Projects::ProjectMembersController do delete :leave, namespace_id: project.namespace, project_id: project - expect(response).to set_flash.to 'You left the project.' + expect(response).to set_flash.to "You left the \"#{project.human_name}\" project." expect(response).to redirect_to(dashboard_projects_path) expect(project.users).not_to include user end @@ -167,14 +167,14 @@ describe Projects::ProjectMembersController do sign_in(user) end - it 'cannot removes himself from the project' do + it 'cannot remove himself from the project' do delete :leave, namespace_id: project.namespace, project_id: project expect(response).to redirect_to( - namespace_project_project_members_path(project.namespace, project) + namespace_project_path(project.namespace, project) ) - expect(response).to set_flash[:alert].to 'You can not leave your own project. Transfer or delete the project.' + expect(response).to set_flash[:alert].to "You can not leave the \"#{project.human_name}\" project. Transfer or delete the project." expect(project.users).to include user end end @@ -189,9 +189,9 @@ describe Projects::ProjectMembersController do delete :leave, namespace_id: project.namespace, project_id: project - expect(response).to set_flash.to 'You withdrawn your access request to the project.' + expect(response).to set_flash.to 'Your access request to the project has been withdrawn.' expect(response).to redirect_to(dashboard_projects_path) - expect(project.project_members.request).to be_empty + expect(project.members.request).to be_empty expect(project.users).not_to include user end end @@ -214,7 +214,7 @@ describe Projects::ProjectMembersController do expect(response).to redirect_to( namespace_project_path(project.namespace, project) ) - expect(project.project_members.request.find_by(created_by_id: user.id).created_by).to eq user + expect(project.members.request.exists?(user_id: user)).to be_truthy expect(project.users).not_to include user end end @@ -225,8 +225,8 @@ describe Projects::ProjectMembersController do context 'when member is not found' do it 'returns 404' do post :approve_access_request, namespace_id: project.namespace, - project_id: project, - id: 42 + project_id: project, + id: 42 expect(response.status).to eq(404) end @@ -237,7 +237,7 @@ describe Projects::ProjectMembersController do let(:team_requester) { create(:user) } let(:member) do project.request_access(team_requester) - project.project_members.request.find_by(created_by_id: team_requester.id) + project.members.request.find_by(user_id: team_requester.id) end context 'when user does not have enough rights' do @@ -248,8 +248,8 @@ describe Projects::ProjectMembersController do it 'returns 404' do post :approve_access_request, namespace_id: project.namespace, - project_id: project, - id: member + project_id: project, + id: member expect(response.status).to eq(404) expect(project.users).not_to include team_requester @@ -264,8 +264,8 @@ describe Projects::ProjectMembersController do it 'adds user to members' do post :approve_access_request, namespace_id: project.namespace, - project_id: project, - id: member + project_id: project, + id: member expect(response).to redirect_to( namespace_project_project_members_path(project.namespace, project) |