2012-09-10 15:35:23 +02:00
|
|
|
class ProjectTeamManagement < Spinach::FeatureSteps
|
2012-09-10 17:35:03 +02:00
|
|
|
include SharedAuthentication
|
|
|
|
include SharedProject
|
|
|
|
include SharedPaths
|
|
|
|
|
2012-09-10 15:35:23 +02:00
|
|
|
Then 'I should be able to see myself in team' do
|
|
|
|
page.should have_content(@user.name)
|
|
|
|
page.should have_content(@user.email)
|
|
|
|
end
|
|
|
|
|
|
|
|
And 'I should see "Sam" in team list' do
|
|
|
|
user = User.find_by_name("Sam")
|
|
|
|
page.should have_content(user.name)
|
|
|
|
page.should have_content(user.email)
|
|
|
|
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")
|
|
|
|
within "#new_team_member" do
|
|
|
|
select user.name, :from => "user_ids"
|
|
|
|
select "Reporter", :from => "project_access"
|
|
|
|
end
|
2013-01-30 16:13:05 +01:00
|
|
|
click_button "Add users"
|
2012-09-10 15:35:23 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
Then 'I should see "Mike" in team list as "Reporter"' do
|
|
|
|
user = User.find_by_name("Mike")
|
|
|
|
role_id = find(".user_#{user.id} #team_member_project_access").value
|
|
|
|
role_id.should == UsersProject.access_roles["Reporter"].to_s
|
|
|
|
end
|
|
|
|
|
|
|
|
Given 'I should see "Sam" in team list as "Developer"' do
|
|
|
|
user = User.find_by_name("Sam")
|
|
|
|
role_id = find(".user_#{user.id} #team_member_project_access").value
|
|
|
|
role_id.should == UsersProject.access_roles["Developer"].to_s
|
|
|
|
end
|
|
|
|
|
|
|
|
And 'I change "Sam" role to "Reporter"' do
|
|
|
|
user = User.find_by_name("Sam")
|
|
|
|
within ".user_#{user.id}" do
|
|
|
|
select "Reporter", :from => "team_member_project_access"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
And 'I should see "Sam" in team list as "Reporter"' do
|
|
|
|
user = User.find_by_name("Sam")
|
|
|
|
role_id = find(".user_#{user.id} #team_member_project_access").value
|
|
|
|
role_id.should == UsersProject.access_roles["Reporter"].to_s
|
|
|
|
end
|
|
|
|
|
|
|
|
Given 'I click link "Sam"' do
|
2013-02-21 11:39:09 +01:00
|
|
|
first(:link, "Sam").click
|
2012-09-10 15:35:23 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
Then 'I should see "Sam" team profile' do
|
|
|
|
user = User.find_by_name("Sam")
|
|
|
|
page.should have_content(user.name)
|
|
|
|
page.should have_content(user.email)
|
|
|
|
page.should have_content("To team list")
|
|
|
|
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)
|
|
|
|
page.should_not have_content(user.email)
|
|
|
|
end
|
|
|
|
|
|
|
|
And 'gitlab user "Mike"' do
|
2012-11-06 04:31:55 +01:00
|
|
|
create(:user, :name => "Mike")
|
2012-09-10 15:35:23 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
And 'gitlab user "Sam"' do
|
2012-11-06 04:31:55 +01:00
|
|
|
create(:user, :name => "Sam")
|
2012-09-10 15:35:23 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
And '"Sam" is "Shop" developer' do
|
|
|
|
user = User.find_by_name("Sam")
|
|
|
|
project = Project.find_by_name("Shop")
|
2013-01-04 07:43:25 +01:00
|
|
|
project.team << [user, :developer]
|
2012-09-10 15:35:23 +02:00
|
|
|
end
|
2012-10-24 14:23:04 +02:00
|
|
|
|
|
|
|
Given 'I own project "Website"' do
|
2012-11-06 04:31:55 +01:00
|
|
|
@project = create(:project, :name => "Website")
|
2013-01-04 07:43:25 +01:00
|
|
|
@project.team << [@user, :master]
|
2012-10-24 14:23:04 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
And '"Mike" is "Website" reporter' do
|
|
|
|
user = User.find_by_name("Mike")
|
|
|
|
project = Project.find_by_name("Website")
|
2013-01-04 07:43:25 +01:00
|
|
|
project.team << [user, :reporter]
|
2012-10-24 14:23:04 +02: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
|
|
|
|
select 'Website', from: 'source_project_id'
|
|
|
|
click_button 'Import'
|
|
|
|
end
|
2012-09-10 15:35:23 +02:00
|
|
|
end
|