2012-09-10 09:35:23 -04:00
|
|
|
class ProjectTeamManagement < Spinach::FeatureSteps
|
2012-09-10 11:35:03 -04:00
|
|
|
include SharedAuthentication
|
|
|
|
include SharedProject
|
|
|
|
include SharedPaths
|
2013-03-14 04:16:27 -04:00
|
|
|
include Select2Helper
|
2012-09-10 11:35:03 -04:00
|
|
|
|
2012-09-10 09:35:23 -04:00
|
|
|
Then 'I should be able to see myself in team' do
|
|
|
|
page.should have_content(@user.name)
|
2013-03-13 13:16:36 -04:00
|
|
|
page.should have_content(@user.username)
|
2012-09-10 09:35:23 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
And 'I should see "Sam" in team list' do
|
|
|
|
user = User.find_by_name("Sam")
|
|
|
|
page.should have_content(user.name)
|
2013-03-13 13:16:36 -04:00
|
|
|
page.should have_content(user.username)
|
2012-09-10 09:35:23 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
Given 'I click link "New Team Member"' do
|
|
|
|
click_link "New Team Member"
|
|
|
|
end
|
|
|
|
|
|
|
|
And 'I select "Mike" as "Reporter"' do
|
|
|
|
user = User.find_by_name("Mike")
|
2013-03-14 04:16:27 -04:00
|
|
|
|
|
|
|
select2(user.id, from: "#user_ids", multiple: true)
|
2012-09-10 09:35:23 -04:00
|
|
|
within "#new_team_member" do
|
2013-04-11 04:25:11 -04:00
|
|
|
select "Reporter", from: "project_access"
|
2012-09-10 09:35:23 -04:00
|
|
|
end
|
2013-01-30 10:13:05 -05:00
|
|
|
click_button "Add users"
|
2012-09-10 09:35:23 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
Then 'I should see "Mike" in team list as "Reporter"' do
|
2013-06-19 12:38:43 -04:00
|
|
|
within ".access-reporter" do
|
2013-04-12 02:56:10 -04:00
|
|
|
page.should have_content('Mike')
|
|
|
|
end
|
2012-09-10 09:35:23 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
Given 'I should see "Sam" in team list as "Developer"' do
|
2013-06-19 12:38:43 -04:00
|
|
|
within ".access-developer" do
|
2013-04-12 02:56:10 -04:00
|
|
|
page.should have_content('Sam')
|
|
|
|
end
|
2012-09-10 09:35:23 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
And 'I change "Sam" role to "Reporter"' do
|
|
|
|
user = User.find_by_name("Sam")
|
2013-06-19 12:38:43 -04:00
|
|
|
within "#user_#{user.id}" do
|
2013-04-11 04:25:11 -04:00
|
|
|
select "Reporter", from: "team_member_project_access"
|
2012-09-10 09:35:23 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
And 'I should see "Sam" in team list as "Reporter"' do
|
2013-06-19 12:38:43 -04:00
|
|
|
within ".access-reporter" do
|
2013-04-12 02:56:10 -04:00
|
|
|
page.should have_content('Sam')
|
|
|
|
end
|
2012-09-10 09:35:23 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
And 'I click link "Remove from team"' do
|
|
|
|
click_link "Remove from team"
|
|
|
|
end
|
|
|
|
|
|
|
|
And 'I should not see "Sam" in team list' do
|
|
|
|
user = User.find_by_name("Sam")
|
|
|
|
page.should_not have_content(user.name)
|
2013-03-13 13:16:36 -04:00
|
|
|
page.should_not have_content(user.username)
|
2012-09-10 09:35:23 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
And 'gitlab user "Mike"' do
|
2013-04-11 04:25:11 -04:00
|
|
|
create(:user, name: "Mike")
|
2012-09-10 09:35:23 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
And 'gitlab user "Sam"' do
|
2013-04-11 04:25:11 -04:00
|
|
|
create(:user, name: "Sam")
|
2012-09-10 09:35:23 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
And '"Sam" is "Shop" developer' do
|
|
|
|
user = User.find_by_name("Sam")
|
|
|
|
project = Project.find_by_name("Shop")
|
2013-01-04 01:43:25 -05:00
|
|
|
project.team << [user, :developer]
|
2012-09-10 09:35:23 -04:00
|
|
|
end
|
2012-10-24 08:23:04 -04:00
|
|
|
|
|
|
|
Given 'I own project "Website"' do
|
2013-06-22 16:57:29 -04:00
|
|
|
@project = create(:project, name: "Website", namespace: @user.namespace)
|
2013-01-04 01:43:25 -05:00
|
|
|
@project.team << [@user, :master]
|
2012-10-24 08:23:04 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
And '"Mike" is "Website" reporter' do
|
|
|
|
user = User.find_by_name("Mike")
|
|
|
|
project = Project.find_by_name("Website")
|
2013-01-04 01:43:25 -05:00
|
|
|
project.team << [user, :reporter]
|
2012-10-24 08:23:04 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
And 'I click link "Import team from another project"' do
|
|
|
|
click_link "Import team from another project"
|
|
|
|
end
|
|
|
|
|
|
|
|
When 'I submit "Website" project for import team' do
|
2013-06-22 16:57:29 -04:00
|
|
|
project = Project.find_by_name("Website")
|
|
|
|
select project.name_with_namespace, from: 'source_project_id'
|
2012-10-24 08:23:04 -04:00
|
|
|
click_button 'Import'
|
|
|
|
end
|
2013-03-13 13:16:36 -04:00
|
|
|
|
|
|
|
step 'I click cancel link for "Sam"' do
|
|
|
|
within "#user_#{User.find_by_name('Sam').id}" do
|
|
|
|
click_link('Remove user from team')
|
|
|
|
end
|
|
|
|
end
|
2012-09-10 09:35:23 -04:00
|
|
|
end
|