2014-09-22 10:30:25 -04:00
|
|
|
class Spinach::Features::AdminProjects < Spinach::FeatureSteps
|
2013-01-09 00:14:05 -05:00
|
|
|
include SharedAuthentication
|
|
|
|
include SharedPaths
|
|
|
|
include SharedAdmin
|
2015-08-18 11:46:57 -04:00
|
|
|
include SharedProject
|
2015-12-01 17:47:26 -05:00
|
|
|
include SharedUser
|
|
|
|
include Select2Helper
|
2015-08-18 11:46:57 -04:00
|
|
|
|
|
|
|
step 'I should see all non-archived projects' do
|
|
|
|
Project.non_archived.each do |p|
|
|
|
|
expect(page).to have_content p.name_with_namespace
|
|
|
|
end
|
|
|
|
end
|
2013-01-09 00:14:05 -05:00
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see all projects' do
|
2013-01-09 00:14:05 -05:00
|
|
|
Project.all.each do |p|
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content p.name_with_namespace
|
2013-01-09 00:14:05 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-08-18 11:46:57 -04:00
|
|
|
step 'I check "Show archived projects"' do
|
|
|
|
page.check 'Show archived projects'
|
|
|
|
click_button "Search"
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see "archived" label' do
|
|
|
|
expect(page).to have_xpath("//span[@class='label label-warning']", text: 'archived')
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I click on first project' do
|
2013-01-09 00:14:05 -05:00
|
|
|
click_link Project.first.name_with_namespace
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see project details' do
|
2013-01-09 00:14:05 -05:00
|
|
|
project = Project.first
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(current_path).to eq admin_namespace_project_path(project.namespace, project)
|
|
|
|
expect(page).to have_content(project.name_with_namespace)
|
|
|
|
expect(page).to have_content(project.creator.name)
|
2013-01-09 00:14:05 -05:00
|
|
|
end
|
2014-06-19 06:20:42 -04:00
|
|
|
|
|
|
|
step 'I visit admin project page' do
|
2015-01-24 13:02:58 -05:00
|
|
|
visit admin_namespace_project_path(project.namespace, project)
|
2014-06-19 06:20:42 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I transfer project to group \'Web\'' do
|
2015-10-06 10:09:03 -04:00
|
|
|
allow_any_instance_of(Projects::TransferService).
|
|
|
|
to receive(:move_uploads_to_new_namespace).and_return(true)
|
2015-01-24 13:02:58 -05:00
|
|
|
find(:xpath, "//input[@id='new_namespace_id']").set group.id
|
2014-06-19 06:20:42 -04:00
|
|
|
click_button 'Transfer'
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'group \'Web\'' do
|
|
|
|
create(:group, name: 'Web')
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see project transfered' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content 'Web / ' + project.name
|
|
|
|
expect(page).to have_content 'Namespace: Web'
|
2014-06-19 06:20:42 -04:00
|
|
|
end
|
|
|
|
|
2015-12-01 17:47:26 -05:00
|
|
|
step 'I visit project "Enterprise" members page' do
|
|
|
|
project = Project.find_by!(name: "Enterprise")
|
|
|
|
visit namespace_project_project_members_path(project.namespace, project)
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I select current user as "Developer"' do
|
|
|
|
page.within ".users-project-form" do
|
|
|
|
select2(current_user.id, from: "#user_ids", multiple: true)
|
|
|
|
select "Developer", from: "access_level"
|
|
|
|
end
|
|
|
|
|
|
|
|
click_button "Add users to project"
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see current user as "Developer"' do
|
|
|
|
page.within '.content-list' do
|
|
|
|
expect(page).to have_content(current_user.name)
|
|
|
|
expect(page).to have_content('Developer')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'current user is developer of project "Enterprise"' do
|
|
|
|
project = Project.find_by!(name: "Enterprise")
|
|
|
|
project.team << [current_user, :developer]
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I click on the "Remove User From Project" button for current user' do
|
|
|
|
find(:css, 'li', text: current_user.name).find(:css, 'a.btn-remove').click
|
|
|
|
# poltergeist always confirms popups.
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should not see current_user as "Developer"' do
|
|
|
|
expect(page).not_to have_selector(:css, '.content-list')
|
|
|
|
end
|
|
|
|
|
2014-06-19 06:20:42 -04:00
|
|
|
def project
|
|
|
|
@project ||= Project.first
|
|
|
|
end
|
|
|
|
|
|
|
|
def group
|
|
|
|
Group.find_by(name: 'Web')
|
|
|
|
end
|
2013-01-09 00:14:05 -05:00
|
|
|
end
|