summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-09-02 15:10:22 +0100
committerPhil Hughes <me@iamphill.com>2016-09-13 08:44:59 +0100
commit2c3fa33ca2e75792d1027eb73e2f69fed67bc435 (patch)
treea3847dd541e7133ce5f6f4cf61a7023251b70bb2
parentccf76831da422298242ce3d8d11f72ab50454c85 (diff)
downloadgitlab-ce-2c3fa33ca2e75792d1027eb73e2f69fed67bc435.tar.gz
Updated some specs
Fixed issue with group name not showing
-rw-r--r--app/controllers/projects/project_members_controller.rb19
-rw-r--r--app/views/projects/project_members/_team.html.haml2
-rw-r--r--app/views/projects/project_members/index.html.haml4
-rw-r--r--app/views/shared/members/_member.html.haml7
-rw-r--r--features/steps/group/members.rb8
-rw-r--r--spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb8
6 files changed, 24 insertions, 24 deletions
diff --git a/app/controllers/projects/project_members_controller.rb b/app/controllers/projects/project_members_controller.rb
index 7581833eacc..bf6ac25266a 100644
--- a/app/controllers/projects/project_members_controller.rb
+++ b/app/controllers/projects/project_members_controller.rb
@@ -7,7 +7,6 @@ class Projects::ProjectMembersController < Projects::ApplicationController
def index
@groups = @project.project_group_links
- members = []
project_members = @project.project_members
project_members = project_members.non_invite unless can?(current_user, :admin_project, @project)
@@ -16,25 +15,25 @@ class Projects::ProjectMembersController < Projects::ApplicationController
project_members = project_members.where(user_id: users)
end
- members << project_members.pluck(:id)
+ members_ids = project_members.pluck(:id)
- @group = @project.group
- if @group
- group_members = @group.group_members
+ group = @project.group
+ if group
+ group_members = group.group_members
group_members = group_members.non_invite unless can?(current_user, :admin_project, @project)
if params[:search].present?
- users = @group.users.search(params[:search]).to_a
+ users = group.users.search(params[:search]).to_a
group_members = group_members.where(user_id: users)
end
- members << group_members.pluck(:id)
+ members_ids << group_members.pluck(:id)
end
- @project_members = Member.where(id: members)
- @project_members_size = @project_members.size
+ @members = Member.where(id: members_ids.flatten)
+ @members_size = @members.size
- @project_members = @project_members.page(params[:page])
+ @members = @members.page(params[:page])
@requesters = @project.requesters if can?(current_user, :admin_project, @project)
diff --git a/app/views/projects/project_members/_team.html.haml b/app/views/projects/project_members/_team.html.haml
index 867cb2b97e4..d9799033e17 100644
--- a/app/views/projects/project_members/_team.html.haml
+++ b/app/views/projects/project_members/_team.html.haml
@@ -2,7 +2,7 @@
.panel-heading
Users with access to
%strong #{@project.name}
- %span.badge= @project_members_size
+ %span.badge= @members_size
%ul.content-list
- members.each do |member|
= render 'shared/members/member', member: member
diff --git a/app/views/projects/project_members/index.html.haml b/app/views/projects/project_members/index.html.haml
index a90de32bd47..80882d0c11c 100644
--- a/app/views/projects/project_members/index.html.haml
+++ b/app/views/projects/project_members/index.html.haml
@@ -25,5 +25,5 @@
- if @groups.size > 0
= render 'groups', groups: @groups
- = render 'team', members: @project_members
- = paginate @project_members, theme: "gitlab"
+ = render 'team', members: @members
+ = paginate @members, theme: "gitlab"
diff --git a/app/views/shared/members/_member.html.haml b/app/views/shared/members/_member.html.haml
index 2f98eeff658..6f8c3c4da2e 100644
--- a/app/views/shared/members/_member.html.haml
+++ b/app/views/shared/members/_member.html.haml
@@ -1,6 +1,7 @@
- show_roles = local_assigns.fetch(:show_roles, true)
- show_controls = local_assigns.fetch(:show_controls, true)
- user = local_assigns.fetch(:user, member.user)
+- source = member.source
%li.member{ class: dom_class(member), id: dom_id(member) }
%span{ class: ("list-item-name" if show_controls) }
@@ -17,9 +18,9 @@
%label.label.label-danger
%strong Blocked
- - if member.respond_to?(:group) && !@group
- = link_to member.group, class: "member-group-link prepend-left-5" do
- = "· #{member.group.name}"
+ - if source.instance_of?(Group) && !@group
+ = link_to source, class: "member-group-link prepend-left-5" do
+ = "· #{source.name}"
.hidden-xs.cgray
- if member.request?
diff --git a/features/steps/group/members.rb b/features/steps/group/members.rb
index 4aec3d03ef6..e54add1d568 100644
--- a/features/steps/group/members.rb
+++ b/features/steps/group/members.rb
@@ -14,7 +14,7 @@ class Spinach::Features::GroupMembers < Spinach::FeatureSteps
select "Reporter", from: "access_level"
end
- click_button "Add users to group"
+ click_button "Add to group"
end
step 'I select "Mike" as "Master"' do
@@ -25,7 +25,7 @@ class Spinach::Features::GroupMembers < Spinach::FeatureSteps
select "Master", from: "access_level"
end
- click_button "Add users to group"
+ click_button "Add to group"
end
step 'I should see "Mike" in team list as "Reporter"' do
@@ -48,7 +48,7 @@ class Spinach::Features::GroupMembers < Spinach::FeatureSteps
select "Reporter", from: "access_level"
end
- click_button "Add users to group"
+ click_button "Add to group"
end
step 'I should see "sjobs@apple.com" in team list as invited "Reporter"' do
@@ -67,7 +67,7 @@ class Spinach::Features::GroupMembers < Spinach::FeatureSteps
select "Reporter", from: "access_level"
end
- click_button "Add users to group"
+ click_button "Add to group"
end
step 'I should see user "John Doe" in team list' do
diff --git a/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb b/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb
index 430c384ac2e..27a83fdcd1f 100644
--- a/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb
+++ b/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb
@@ -1,6 +1,7 @@
require 'spec_helper'
feature 'Projects > Members > Master adds member with expiration date', feature: true, js: true do
+ include WaitForAjax
include Select2Helper
include ActiveSupport::Testing::TimeHelpers
@@ -20,7 +21,7 @@ feature 'Projects > Members > Master adds member with expiration date', feature:
page.within '.users-project-form' do
select2(new_member.id, from: '#user_ids', multiple: true)
fill_in 'expires_at', with: '2016-08-10'
- click_on 'Add users to project'
+ click_on 'Add to project'
end
page.within '.project_member:first-child' do
@@ -35,9 +36,8 @@ feature 'Projects > Members > Master adds member with expiration date', feature:
visit namespace_project_project_members_path(project.namespace, project)
page.within '.project_member:first-child' do
- click_on 'Edit'
- fill_in 'Access expiration date', with: '2016-08-09'
- click_on 'Save'
+ find('.js-access-expiration-date').set '2016-08-09'
+ wait_for_ajax
expect(page).to have_content('Expires in 3 days')
end
end