2011-10-08 17:36:38 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe "Projects" do
|
|
|
|
before { login_as :user }
|
|
|
|
|
|
|
|
describe "GET /projects/show" do
|
2011-10-26 09:46:25 -04:00
|
|
|
before do
|
2012-11-05 22:31:55 -05:00
|
|
|
@project = create(:project, owner: @user)
|
2011-10-08 17:36:38 -04: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 06:39:57 -04:00
|
|
|
end
|
|
|
|
|
2011-10-08 17:36:38 -04:00
|
|
|
describe "GET /projects/:id/edit" do
|
2011-10-26 09:46:25 -04:00
|
|
|
before do
|
2012-11-05 22:31:55 -05:00
|
|
|
@project = create(:project)
|
2011-10-08 17:36:38 -04:00
|
|
|
@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 14:49:34 -04:00
|
|
|
page.should have_content("Project name is")
|
|
|
|
page.should have_content("Advanced settings:")
|
|
|
|
page.should have_content("Features:")
|
2011-10-08 17:36:38 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "PUT /projects/:id" do
|
2011-10-26 09:46:25 -04:00
|
|
|
before do
|
2012-11-05 22:31:55 -05:00
|
|
|
@project = create(:project, owner: @user)
|
2011-10-08 17:36:38 -04:00
|
|
|
@project.add_access(@user, :admin, :read)
|
|
|
|
|
|
|
|
visit edit_project_path(@project)
|
|
|
|
|
2012-08-10 18:07:50 -04:00
|
|
|
fill_in 'project_name', with: 'Awesome'
|
2011-12-15 16:21:29 -05:00
|
|
|
click_button "Save"
|
2011-10-08 17:36:38 -04:00
|
|
|
@project = @project.reload
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should be correct path" do
|
2012-02-07 18:00:49 -05:00
|
|
|
current_path.should == edit_project_path(@project)
|
2011-10-08 17:36:38 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should show project" do
|
|
|
|
page.should have_content("Awesome")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-05-27 06:39:57 -04:00
|
|
|
describe "DELETE /projects/:id" do
|
|
|
|
before do
|
2012-11-05 22:31:55 -05:00
|
|
|
@project = create(:project)
|
2012-05-27 06:39:57 -04:00
|
|
|
@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 17:36:38 -04:00
|
|
|
end
|