Updated some specs

Fixed issue with group name not showing
This commit is contained in:
Phil Hughes 2016-09-02 15:10:22 +01:00
parent ccf76831da
commit 2c3fa33ca2
6 changed files with 24 additions and 24 deletions

View file

@ -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)

View file

@ -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

View file

@ -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"

View file

@ -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?

View file

@ -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

View file

@ -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