mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-11 05:36:07 +10:00
Conflicts: Gemfile.lock app/controllers/admin/application_settings_controller.rb app/controllers/groups/application_controller.rb app/controllers/groups/group_members_controller.rb app/controllers/projects/team_members_controller.rb app/helpers/application_settings_helper.rb app/helpers/projects_helper.rb app/helpers/tab_helper.rb app/models/application_setting.rb app/models/user.rb app/views/devise/shared/_signin_box.html.haml app/views/groups/projects.html.haml app/views/profiles/keys/_key.html.haml app/views/projects/team_members/_form.html.haml app/views/projects/team_members/index.html.haml config/routes.rb db/schema.rb spec/lib/gitlab/ldap/access_spec.rb
105 lines
2.6 KiB
Ruby
105 lines
2.6 KiB
Ruby
class Spinach::Features::AdminGroups < Spinach::FeatureSteps
|
|
include SharedAuthentication
|
|
include SharedPaths
|
|
include SharedUser
|
|
include SharedActiveTab
|
|
include Select2Helper
|
|
|
|
When 'I visit admin group page' do
|
|
visit admin_group_path(current_group)
|
|
end
|
|
|
|
When 'I click new group link' do
|
|
click_link "New Group"
|
|
end
|
|
|
|
step 'I have group with projects' do
|
|
@group = create(:group)
|
|
@project = create(:project, group: @group)
|
|
@event = create(:closed_issue_event, project: @project)
|
|
|
|
@project.team << [current_user, :master]
|
|
end
|
|
|
|
step 'submit form with new group info' do
|
|
fill_in 'group_path', with: 'gitlab'
|
|
fill_in 'group_description', with: 'Group description'
|
|
click_button "Create group"
|
|
end
|
|
|
|
step 'I should see newly created group' do
|
|
page.should have_content "Group: gitlab"
|
|
page.should have_content "Group description"
|
|
end
|
|
|
|
step 'I should be redirected to group page' do
|
|
current_path.should == admin_group_path(Group.find_by(path: 'gitlab'))
|
|
end
|
|
|
|
When 'I select user "John Doe" from user list as "Reporter"' do
|
|
select2(user_john.id, from: "#user_ids", multiple: true)
|
|
within "#new_project_member" do
|
|
select "Reporter", from: "access_level"
|
|
end
|
|
click_button "Add users to group"
|
|
end
|
|
|
|
step 'I should see "John Doe" in team list in every project as "Reporter"' do
|
|
within ".group-users-list" do
|
|
page.should have_content "John Doe"
|
|
page.should have_content "Reporter"
|
|
end
|
|
end
|
|
|
|
step 'I should be all groups' do
|
|
Group.all.each do |group|
|
|
page.should have_content group.name
|
|
end
|
|
end
|
|
|
|
step 'group has shared projects' do
|
|
share_link = shared_project.project_group_links.new(group_access: Gitlab::Access::MASTER)
|
|
share_link.group_id = current_group.id
|
|
share_link.save!
|
|
end
|
|
|
|
step 'I visit group page' do
|
|
visit admin_group_path(current_group)
|
|
end
|
|
|
|
step 'I should see project shared with group' do
|
|
page.should have_content(shared_project.name_with_namespace)
|
|
page.should have_content "Projects shared with"
|
|
end
|
|
|
|
step 'we have user "John Doe" in group' do
|
|
current_group.add_user(user_john, Gitlab::Access::REPORTER)
|
|
end
|
|
|
|
step 'I remove user "John Doe" from group' do
|
|
within "#user_#{user_john.id}" do
|
|
click_link 'Remove user from group'
|
|
end
|
|
end
|
|
|
|
step 'I should not see "John Doe" in team list' do
|
|
within ".group-users-list" do
|
|
page.should_not have_content "John Doe"
|
|
end
|
|
end
|
|
|
|
protected
|
|
|
|
def current_group
|
|
@group ||= Group.first
|
|
end
|
|
|
|
def shared_project
|
|
@shared_project ||= create(:empty_project)
|
|
end
|
|
|
|
def user_john
|
|
@user_john ||= User.find_by(name: "John Doe")
|
|
end
|
|
end
|