2014-09-22 10:30:25 -04:00
|
|
|
class Spinach::Features::AdminGroups < Spinach::FeatureSteps
|
2012-10-22 14:42:06 -04:00
|
|
|
include SharedAuthentication
|
|
|
|
include SharedPaths
|
2014-01-27 09:53:59 -05:00
|
|
|
include SharedUser
|
2012-10-22 14:42:06 -04:00
|
|
|
include SharedActiveTab
|
2013-06-10 10:09:30 -04:00
|
|
|
include Select2Helper
|
2012-10-22 14:42:06 -04:00
|
|
|
|
2012-12-25 17:52:20 -05:00
|
|
|
When 'I visit admin group page' do
|
|
|
|
visit admin_group_path(current_group)
|
|
|
|
end
|
|
|
|
|
2012-10-22 14:42:06 -04:00
|
|
|
When 'I click new group link' do
|
|
|
|
click_link "New Group"
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I have group with projects' do
|
2012-12-25 17:52:20 -05:00
|
|
|
@group = create(:group)
|
|
|
|
@project = create(:project, group: @group)
|
|
|
|
@event = create(:closed_issue_event, project: @project)
|
|
|
|
|
2013-01-04 01:43:25 -05:00
|
|
|
@project.team << [current_user, :master]
|
2012-12-25 17:52:20 -05:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'submit form with new group info' do
|
2014-12-22 09:48:40 -05:00
|
|
|
fill_in 'group_path', with: 'gitlab'
|
2013-05-05 10:01:10 -04:00
|
|
|
fill_in 'group_description', with: 'Group description'
|
2012-11-27 14:33:56 -05:00
|
|
|
click_button "Create group"
|
2012-10-22 14:42:06 -04:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see newly created group' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "Group: gitlab"
|
|
|
|
expect(page).to have_content "Group description"
|
2012-10-22 14:42:06 -04:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should be redirected to group page' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(current_path).to eq admin_group_path(Group.find_by(path: 'gitlab'))
|
2012-10-22 14:42:06 -04:00
|
|
|
end
|
2012-12-25 17:52:20 -05:00
|
|
|
|
2014-01-27 09:53:59 -05:00
|
|
|
When 'I select user "John Doe" from user list as "Reporter"' do
|
2014-10-20 06:18:07 -04:00
|
|
|
select2(user_john.id, from: "#user_ids", multiple: true)
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within "#new_project_member" do
|
2014-09-15 09:45:28 -04:00
|
|
|
select "Reporter", from: "access_level"
|
2012-12-25 17:52:20 -05:00
|
|
|
end
|
2015-02-03 19:55:31 -05:00
|
|
|
click_button "Add users to group"
|
2012-12-25 17:52:20 -05:00
|
|
|
end
|
|
|
|
|
2015-08-21 00:33:00 -04:00
|
|
|
When 'I select user "johndoe@gitlab.com" from user list as "Reporter"' do
|
|
|
|
select2('johndoe@gitlab.com', from: "#user_ids", multiple: true)
|
|
|
|
page.within "#new_project_member" do
|
|
|
|
select "Reporter", from: "access_level"
|
|
|
|
end
|
|
|
|
click_button "Add users to group"
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see "John Doe" in team list in every project as "Reporter"' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within ".group-users-list" do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "John Doe"
|
|
|
|
expect(page).to have_content "Reporter"
|
2013-06-20 06:29:17 -04:00
|
|
|
end
|
2012-12-25 17:52:20 -05:00
|
|
|
end
|
|
|
|
|
2015-08-21 00:33:00 -04:00
|
|
|
step 'I should see "johndoe@gitlab.com" in team list in every project as "Reporter"' do
|
|
|
|
page.within ".group-users-list" do
|
|
|
|
expect(page).to have_content "johndoe@gitlab.com (invited)"
|
|
|
|
expect(page).to have_content "Reporter"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-06-26 08:09:17 -04:00
|
|
|
step 'I should be all groups' do
|
|
|
|
Group.all.each do |group|
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content group.name
|
2013-06-26 08:09:17 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-10-20 06:18:07 -04:00
|
|
|
step 'we have user "John Doe" in group' do
|
2015-08-07 00:20:02 -04:00
|
|
|
current_group.add_reporter(user_john)
|
2014-10-20 06:18:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I remove user "John Doe" from group' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within "#user_#{user_john.id}" do
|
2014-10-20 06:18:07 -04:00
|
|
|
click_link 'Remove user from group'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should not see "John Doe" in team list' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within ".group-users-list" do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).not_to have_content "John Doe"
|
2014-10-20 06:18:07 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-12-25 17:52:20 -05:00
|
|
|
protected
|
|
|
|
|
|
|
|
def current_group
|
|
|
|
@group ||= Group.first
|
|
|
|
end
|
2014-10-20 06:18:07 -04:00
|
|
|
|
|
|
|
def user_john
|
|
|
|
@user_john ||= User.find_by(name: "John Doe")
|
|
|
|
end
|
2012-10-22 14:42:06 -04:00
|
|
|
end
|