2015-04-26 12:48:37 +05:30
|
|
|
class Spinach::Features::AdminProjects < Spinach::FeatureSteps
|
2014-09-02 18:07:02 +05:30
|
|
|
include SharedAuthentication
|
|
|
|
include SharedPaths
|
|
|
|
include SharedAdmin
|
2015-09-25 12:07:36 +05:30
|
|
|
include SharedProject
|
|
|
|
|
|
|
|
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
|
2014-09-02 18:07:02 +05:30
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I should see all projects' do
|
2014-09-02 18:07:02 +05:30
|
|
|
Project.all.each do |p|
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content p.name_with_namespace
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-09-25 12:07:36 +05:30
|
|
|
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
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I click on first project' do
|
2014-09-02 18:07:02 +05:30
|
|
|
click_link Project.first.name_with_namespace
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I should see project details' do
|
2014-09-02 18:07:02 +05:30
|
|
|
project = Project.first
|
2015-09-11 14:41:01 +05:30
|
|
|
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)
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I visit admin project page' do
|
2015-04-26 12:48:37 +05:30
|
|
|
visit admin_namespace_project_path(project.namespace, project)
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I transfer project to group \'Web\'' do
|
2015-10-24 18:46:33 +05:30
|
|
|
allow_any_instance_of(Projects::TransferService).
|
|
|
|
to receive(:move_uploads_to_new_namespace).and_return(true)
|
2015-04-26 12:48:37 +05:30
|
|
|
find(:xpath, "//input[@id='new_namespace_id']").set group.id
|
2014-09-02 18:07:02 +05:30
|
|
|
click_button 'Transfer'
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'group \'Web\'' do
|
|
|
|
create(:group, name: 'Web')
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see project transfered' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content 'Web / ' + project.name
|
|
|
|
expect(page).to have_content 'Namespace: Web'
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def project
|
|
|
|
@project ||= Project.first
|
|
|
|
end
|
|
|
|
|
|
|
|
def group
|
|
|
|
Group.find_by(name: 'Web')
|
|
|
|
end
|
|
|
|
end
|