2011-10-08 23:36:38 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe "Projects" do
|
|
|
|
before { login_as :user }
|
|
|
|
|
|
|
|
describe "GET /projects/new" do
|
2011-10-26 15:46:25 +02:00
|
|
|
before do
|
2012-06-12 22:13:42 +02:00
|
|
|
visit root_path
|
2012-01-29 22:59:12 +01:00
|
|
|
click_link "New Project"
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should be correct path" do
|
2011-10-26 15:46:25 +02:00
|
|
|
current_path.should == new_project_path
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should have labels for new project" do
|
2012-04-24 20:49:34 +02:00
|
|
|
page.should have_content("Project name is")
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "POST /projects" do
|
2011-10-26 15:46:25 +02:00
|
|
|
before do
|
2011-10-08 23:36:38 +02:00
|
|
|
visit new_project_path
|
2012-04-24 20:49:34 +02:00
|
|
|
fill_in 'project_name', :with => 'NewProject'
|
|
|
|
fill_in 'project_code', :with => 'NPR'
|
|
|
|
fill_in 'project_path', :with => 'newproject'
|
|
|
|
expect { click_button "Create project" }.to change { Project.count }.by(1)
|
2011-10-08 23:36:38 +02:00
|
|
|
@project = Project.last
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should be correct path" do
|
|
|
|
current_path.should == project_path(@project)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should show project" do
|
|
|
|
page.should have_content(@project.name)
|
|
|
|
page.should have_content(@project.path)
|
|
|
|
page.should have_content(@project.description)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should init repo instructions" do
|
|
|
|
page.should have_content("git remote")
|
|
|
|
page.should have_content(@project.url_to_repo)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /projects/show" do
|
2011-10-26 15:46:25 +02:00
|
|
|
before do
|
2012-01-29 22:59:12 +01:00
|
|
|
@project = Factory :project, :owner => @user
|
2011-10-08 23:36:38 +02:00
|
|
|
@project.add_access(@user, :read)
|
|
|
|
|
|
|
|
visit project_path(@project)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should be correct path" do
|
|
|
|
current_path.should == project_path(@project)
|
|
|
|
end
|
2012-05-27 12:39:57 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /projects/graph" do
|
|
|
|
before do
|
2012-05-27 12:40:43 +02:00
|
|
|
@project = Factory :project
|
2012-05-27 12:39:57 +02:00
|
|
|
@project.add_access(@user, :read)
|
|
|
|
|
|
|
|
visit graph_project_path(@project)
|
|
|
|
end
|
2011-10-08 23:36:38 +02:00
|
|
|
|
2012-05-27 12:39:57 +02:00
|
|
|
it "should be correct path" do
|
|
|
|
current_path.should == graph_project_path(@project)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should have as as team member" do
|
|
|
|
page.should have_content("master")
|
|
|
|
end
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /projects/team" do
|
2011-10-26 15:46:25 +02:00
|
|
|
before do
|
2011-10-08 23:36:38 +02:00
|
|
|
@project = Factory :project
|
|
|
|
@project.add_access(@user, :read)
|
|
|
|
|
|
|
|
visit team_project_path(@project,
|
|
|
|
:path => ValidCommit::BLOB_FILE_PATH,
|
|
|
|
:commit_id => ValidCommit::ID)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should be correct path" do
|
|
|
|
current_path.should == team_project_path(@project)
|
|
|
|
end
|
|
|
|
|
2011-10-26 15:46:25 +02:00
|
|
|
it "should have as as team member" do
|
2011-10-08 23:36:38 +02:00
|
|
|
page.should have_content(@user.name)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /projects/:id/edit" do
|
2011-10-26 15:46:25 +02:00
|
|
|
before do
|
2011-10-08 23:36:38 +02:00
|
|
|
@project = Factory :project
|
|
|
|
@project.add_access(@user, :admin, :read)
|
|
|
|
|
|
|
|
visit edit_project_path(@project)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should be correct path" do
|
|
|
|
current_path.should == edit_project_path(@project)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should have labels for new project" do
|
2012-04-24 20:49:34 +02:00
|
|
|
page.should have_content("Project name is")
|
|
|
|
page.should have_content("Advanced settings:")
|
|
|
|
page.should have_content("Features:")
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "PUT /projects/:id" do
|
2011-10-26 15:46:25 +02:00
|
|
|
before do
|
2012-01-29 22:59:12 +01:00
|
|
|
@project = Factory :project, :owner => @user
|
2011-10-08 23:36:38 +02:00
|
|
|
@project.add_access(@user, :admin, :read)
|
|
|
|
|
|
|
|
visit edit_project_path(@project)
|
|
|
|
|
2012-04-24 20:49:34 +02:00
|
|
|
fill_in 'project_name', :with => 'Awesome'
|
|
|
|
fill_in 'project_path', :with => 'gitlabhq'
|
2011-12-15 22:21:29 +01:00
|
|
|
click_button "Save"
|
2011-10-08 23:36:38 +02:00
|
|
|
@project = @project.reload
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should be correct path" do
|
2012-02-08 00:00:49 +01:00
|
|
|
current_path.should == edit_project_path(@project)
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should show project" do
|
|
|
|
page.should have_content("Awesome")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-05-27 12:39:57 +02:00
|
|
|
describe "DELETE /projects/:id" do
|
|
|
|
before do
|
|
|
|
@project = Factory :project
|
|
|
|
@project.add_access(@user, :read, :admin)
|
|
|
|
visit edit_project_path(@project)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should be correct path" do
|
|
|
|
expect { click_link "Remove" }.to change {Project.count}.by(-1)
|
|
|
|
end
|
|
|
|
end
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|