2011-10-08 23:36:38 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe "Projects" do
|
|
|
|
before { login_as :user }
|
|
|
|
|
|
|
|
describe "GET /projects" do
|
2011-10-26 15:46:25 +02:00
|
|
|
before do
|
2011-10-08 23:36:38 +02:00
|
|
|
visit projects_path
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should be on projects page" do
|
2011-10-26 15:46:25 +02:00
|
|
|
current_path.should == projects_path
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should have link to new project" do
|
2011-11-01 21:51:20 +01:00
|
|
|
page.should have_content("Create new project")
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /projects/new" do
|
2011-10-26 15:46:25 +02:00
|
|
|
before do
|
2011-10-08 23:36:38 +02:00
|
|
|
visit projects_path
|
2011-11-01 21:51:20 +01:00
|
|
|
click_link "Create 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
|
2011-10-26 15:46:25 +02:00
|
|
|
page.should have_content("Name")
|
|
|
|
page.should have_content("Path")
|
|
|
|
page.should have_content("Description")
|
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
|
|
|
|
fill_in 'Name', :with => 'NewProject'
|
|
|
|
fill_in 'Code', :with => 'NPR'
|
2011-10-15 18:30:56 +02:00
|
|
|
fill_in 'Path', :with => 'newproject'
|
2011-10-08 23:36:38 +02:00
|
|
|
expect { click_button "Create Project" }.to change { Project.count }.by(1)
|
|
|
|
@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
|
2011-10-08 23:36:38 +02:00
|
|
|
@project = Factory :project
|
|
|
|
@project.add_access(@user, :read)
|
|
|
|
|
|
|
|
visit project_path(@project)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should be correct path" do
|
|
|
|
current_path.should == project_path(@project)
|
|
|
|
end
|
|
|
|
|
2011-10-26 15:46:25 +02:00
|
|
|
it "should beahave like dashboard" do
|
2011-10-21 13:03:34 +02:00
|
|
|
page.should have_content("History")
|
2011-10-18 16:57:01 +02:00
|
|
|
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
|
2011-10-26 15:46:25 +02:00
|
|
|
page.should have_content("Name")
|
|
|
|
page.should have_content("Path")
|
|
|
|
page.should have_content("Description")
|
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
|
2011-10-08 23:36:38 +02:00
|
|
|
@project = Factory :project
|
|
|
|
@project.add_access(@user, :admin, :read)
|
|
|
|
|
|
|
|
visit edit_project_path(@project)
|
|
|
|
|
|
|
|
fill_in 'Name', :with => 'Awesome'
|
|
|
|
fill_in 'Path', :with => 'legit'
|
|
|
|
fill_in 'Description', :with => 'Awesome project'
|
|
|
|
click_button "Update Project"
|
|
|
|
@project = @project.reload
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should be correct path" do
|
|
|
|
current_path.should == project_path(@project)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should show project" do
|
|
|
|
page.should have_content("Awesome")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
#describe "DELETE /projects/:id", :js => true 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, :admin)
|
|
|
|
#visit projects_path
|
|
|
|
#end
|
|
|
|
|
|
|
|
#it "should be correct path" do
|
2011-10-26 15:46:25 +02:00
|
|
|
#expect { click_link "Destroy" }.to change {Project.count}.by(1)
|
2011-10-08 23:36:38 +02:00
|
|
|
#end
|
|
|
|
#end
|
|
|
|
end
|