Commit 2c3fa33c authored by Phil Hughes's avatar Phil Hughes

Updated some specs

Fixed issue with group name not showing
parent ccf76831
...@@ -7,7 +7,6 @@ class Projects::ProjectMembersController < Projects::ApplicationController ...@@ -7,7 +7,6 @@ class Projects::ProjectMembersController < Projects::ApplicationController
def index def index
@groups = @project.project_group_links @groups = @project.project_group_links
members = []
project_members = @project.project_members project_members = @project.project_members
project_members = project_members.non_invite unless can?(current_user, :admin_project, @project) project_members = project_members.non_invite unless can?(current_user, :admin_project, @project)
...@@ -16,25 +15,25 @@ class Projects::ProjectMembersController < Projects::ApplicationController ...@@ -16,25 +15,25 @@ class Projects::ProjectMembersController < Projects::ApplicationController
project_members = project_members.where(user_id: users) project_members = project_members.where(user_id: users)
end end
members << project_members.pluck(:id) members_ids = project_members.pluck(:id)
@group = @project.group group = @project.group
if @group if group
group_members = @group.group_members group_members = group.group_members
group_members = group_members.non_invite unless can?(current_user, :admin_project, @project) group_members = group_members.non_invite unless can?(current_user, :admin_project, @project)
if params[:search].present? 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) group_members = group_members.where(user_id: users)
end end
members << group_members.pluck(:id) members_ids << group_members.pluck(:id)
end end
@project_members = Member.where(id: members) @members = Member.where(id: members_ids.flatten)
@project_members_size = @project_members.size @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) @requesters = @project.requesters if can?(current_user, :admin_project, @project)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
.panel-heading .panel-heading
Users with access to Users with access to
%strong #{@project.name} %strong #{@project.name}
%span.badge= @project_members_size %span.badge= @members_size
%ul.content-list %ul.content-list
- members.each do |member| - members.each do |member|
= render 'shared/members/member', member: member = render 'shared/members/member', member: member
...@@ -25,5 +25,5 @@ ...@@ -25,5 +25,5 @@
- if @groups.size > 0 - if @groups.size > 0
= render 'groups', groups: @groups = render 'groups', groups: @groups
= render 'team', members: @project_members = render 'team', members: @members
= paginate @project_members, theme: "gitlab" = paginate @members, theme: "gitlab"
- show_roles = local_assigns.fetch(:show_roles, true) - show_roles = local_assigns.fetch(:show_roles, true)
- show_controls = local_assigns.fetch(:show_controls, true) - show_controls = local_assigns.fetch(:show_controls, true)
- user = local_assigns.fetch(:user, member.user) - user = local_assigns.fetch(:user, member.user)
- source = member.source
%li.member{ class: dom_class(member), id: dom_id(member) } %li.member{ class: dom_class(member), id: dom_id(member) }
%span{ class: ("list-item-name" if show_controls) } %span{ class: ("list-item-name" if show_controls) }
...@@ -17,9 +18,9 @@ ...@@ -17,9 +18,9 @@
%label.label.label-danger %label.label.label-danger
%strong Blocked %strong Blocked
- if member.respond_to?(:group) && !@group - if source.instance_of?(Group) && !@group
= link_to member.group, class: "member-group-link prepend-left-5" do = link_to source, class: "member-group-link prepend-left-5" do
= #{member.group.name}" = #{source.name}"
.hidden-xs.cgray .hidden-xs.cgray
- if member.request? - if member.request?
......
...@@ -14,7 +14,7 @@ class Spinach::Features::GroupMembers < Spinach::FeatureSteps ...@@ -14,7 +14,7 @@ class Spinach::Features::GroupMembers < Spinach::FeatureSteps
select "Reporter", from: "access_level" select "Reporter", from: "access_level"
end end
click_button "Add users to group" click_button "Add to group"
end end
step 'I select "Mike" as "Master"' do step 'I select "Mike" as "Master"' do
...@@ -25,7 +25,7 @@ class Spinach::Features::GroupMembers < Spinach::FeatureSteps ...@@ -25,7 +25,7 @@ class Spinach::Features::GroupMembers < Spinach::FeatureSteps
select "Master", from: "access_level" select "Master", from: "access_level"
end end
click_button "Add users to group" click_button "Add to group"
end end
step 'I should see "Mike" in team list as "Reporter"' do step 'I should see "Mike" in team list as "Reporter"' do
...@@ -48,7 +48,7 @@ class Spinach::Features::GroupMembers < Spinach::FeatureSteps ...@@ -48,7 +48,7 @@ class Spinach::Features::GroupMembers < Spinach::FeatureSteps
select "Reporter", from: "access_level" select "Reporter", from: "access_level"
end end
click_button "Add users to group" click_button "Add to group"
end end
step 'I should see "sjobs@apple.com" in team list as invited "Reporter"' do step 'I should see "sjobs@apple.com" in team list as invited "Reporter"' do
...@@ -67,7 +67,7 @@ class Spinach::Features::GroupMembers < Spinach::FeatureSteps ...@@ -67,7 +67,7 @@ class Spinach::Features::GroupMembers < Spinach::FeatureSteps
select "Reporter", from: "access_level" select "Reporter", from: "access_level"
end end
click_button "Add users to group" click_button "Add to group"
end end
step 'I should see user "John Doe" in team list' do step 'I should see user "John Doe" in team list' do
......
require 'spec_helper' require 'spec_helper'
feature 'Projects > Members > Master adds member with expiration date', feature: true, js: true do feature 'Projects > Members > Master adds member with expiration date', feature: true, js: true do
include WaitForAjax
include Select2Helper include Select2Helper
include ActiveSupport::Testing::TimeHelpers include ActiveSupport::Testing::TimeHelpers
...@@ -20,7 +21,7 @@ feature 'Projects > Members > Master adds member with expiration date', feature: ...@@ -20,7 +21,7 @@ feature 'Projects > Members > Master adds member with expiration date', feature:
page.within '.users-project-form' do page.within '.users-project-form' do
select2(new_member.id, from: '#user_ids', multiple: true) select2(new_member.id, from: '#user_ids', multiple: true)
fill_in 'expires_at', with: '2016-08-10' fill_in 'expires_at', with: '2016-08-10'
click_on 'Add users to project' click_on 'Add to project'
end end
page.within '.project_member:first-child' do page.within '.project_member:first-child' do
...@@ -35,9 +36,8 @@ feature 'Projects > Members > Master adds member with expiration date', feature: ...@@ -35,9 +36,8 @@ feature 'Projects > Members > Master adds member with expiration date', feature:
visit namespace_project_project_members_path(project.namespace, project) visit namespace_project_project_members_path(project.namespace, project)
page.within '.project_member:first-child' do page.within '.project_member:first-child' do
click_on 'Edit' find('.js-access-expiration-date').set '2016-08-09'
fill_in 'Access expiration date', with: '2016-08-09' wait_for_ajax
click_on 'Save'
expect(page).to have_content('Expires in 3 days') expect(page).to have_content('Expires in 3 days')
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment